Forum Xamarin.Android

ListView Not Scrollable

meirrotfleischmeirrotfleisch USMember ✭✭✭

I have a layout with a listview and below it a "toolbar" I want the list to be scrollable i Used verticaloptions="fillandExpand" but doesn't help

The following is my layout

<?xml version="1.0" encoding="utf-8"?>


    <Toolbar
        android:id="@+id/toolbar_bottom"
        android:minHeight="?android:attr/actionBarSize"
        android:background="?android:attr/colorAccent"
        android:theme="@android:style/ThemeOverlay.Material.Dark.ActionBar"
        android:popupTheme="@android:style/ThemeOverlay.Material.Light"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
     android:layout_alignParentBottom="true"/>

Looking foward to your kind help :)

Regards

M.R

Best Answer

Answers

  • AnubhavRanjanAnubhavRanjan INXamarin Team Xamurai

    @meirrotfleisch Can you post the complete content including the ListView implementation? The current XML only shows the Toolbar.

    .

    .

    .

    .

    .

    .



    Looking for Free* Microsoft Support on Xamarin Issues, visit https://aka.ms/xamarinsupport


  • meirrotfleischmeirrotfleisch USMember ✭✭✭

    Hi

    Attached is the Activity.cs for the layout..

    Thanks for your time and efforts

    Regards

    M.R.

  • meirrotfleischmeirrotfleisch USMember ✭✭✭

    Forgot to add the Usings :)

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    using Android.App;
    using Android.Content;
    using Android.OS;
    using Android.Runtime;
    using Android.Views;
    using Android.Widget;
    using Android.Provider;
    using Android.Database;
    using Java.Util;
    using TimeZone = System.TimeZoneInfo;
    using Java.Lang;
    using Android.Text.Format;
    using Java.Text;
    using System.Threading.Tasks;
    using Java.Util.Functions;
    using Android.Preferences;

    Regards

    M.R.

  • AnubhavRanjanAnubhavRanjan INXamarin Team Xamurai

    @meirrotfleisch Thanks for sharing the ListView implementation. I also need to see the XML file. Since the data is getting displayed for you except the scroll is not working as you mentioned initially, need to see the XML.

    .

    .

    .

    .

    .



    Looking for Free* Microsoft Support on Xamarin Issues, visit https://aka.ms/xamarinsupport


  • meirrotfleischmeirrotfleisch USMember ✭✭✭

    Hi
    Again thanks for your attention and swift responses.. Attached is the xnml. Hope this helps

    Regards
    Meir

  • jezhjezh Member, Xamarin Team Xamurai
    edited May 2020

    Hi @meirrotfleisch, from the code you posted , I found that you didn't post the full code.
    What's the code of MyUtils and MyReceiver?

    If it is convenient for you, could you please post a basic demo so that we can test on our side?

  • meirrotfleischmeirrotfleisch USMember ✭✭✭
    Thanks for your response. I dont see why myutils and myreceiver should effect the listview. They deal with calendar 📅 events and setting alarms. How ever when I get to the office 🏢 I'll send the full project

    Regards
  • meirrotfleischmeirrotfleisch USMember ✭✭✭

    Hi

    I'm pretty sure i'v narrowed the problem down to the combination of Bottom_toolbar and listview.
    Ill try to create a demo of the situation later on.

    in the mean time Any suggestions?

    Regards

  • meirrotfleischmeirrotfleisch USMember ✭✭✭

    HI

    My app is based on this original demo. I added the "bottom_toolbar" to the EventList.axml and the EventListActivity.cs

    Here the scroll will work but if the list is long the toolbar doesn't show.

    Rather confusing.. Why its reacting differently

    Thanks .. Looking forward to your helpful responses

    Regards

    M.Rotfleisch

  • jezhjezh Member, Xamarin Team Xamurai
    edited May 2020

    You just need to add the following property for your listview:

    android:layout_weight="1"
    
  • meirrotfleischmeirrotfleisch USMember ✭✭✭
    edited May 2020

    @jezh
    Thanks..

    This seems to have helped a bit . but I still seem to be getting a "toolbar" between each item of the listview

    See attached screen shot (from the real app not the demo)

    Regards

    M.R.

  • jezhjezh Member, Xamarin Team Xamurai

    I have modified some codes and added the runtime permission in your code , and I also tesed on my device, it works properly.

    I have uploaded the demo in the attachment, you can check it here.

  • meirrotfleischmeirrotfleisch USMember ✭✭✭

    @jezh : Thanks again for your time.

    When I try to install your demo on a Samsung Galaxy s5 after the request for calendar permissions i get a message saying "screen Overlay detected" and that i need to turn off screen overlay from Settings >apps. Tried to but still it wont load

    When I install on my other device Samsung Galaxy S5 it runs correctly.

    However on my full app (added many features) I still haven't been able to get rid of the "blank toolbar" between each Listed Event.

    I'm attaching my full code here :smile:

    Regards

    Meir

  • jezhjezh Member, Xamarin Team Xamurai
    edited May 2020

    However on my full app (added many features) I still haven't been able to get rid of the "blank toolbar" between each Listed Event.

    In the EventListItem.axml, you have defined a Toolbar in the layout.You can just remove the Toolbar.

      <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <TextView
            android:id="@+id/eventTitle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="16dip" />
        <TextView
            android:id="@+id/eventStartDate"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="12dip" />
        <TextView
            android:id="@+id/eventId"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="12dip" />
        <TextView
            android:id="@+id/EventDescription"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="12dip" />
        <Toolbar
            android:id="@+id/toolbar_bottom2"
            android:minHeight="?android:attr/actionBarSize"
            android:background="?android:attr/colorAccent"
            android:theme="@android:style/ThemeOverlay.Material.Dark.ActionBar"
            android:popupTheme="@android:style/ThemeOverlay.Material.Light"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
        />
    </LinearLayout >
    

    After I removed the toolbar, the result is:

  • meirrotfleischmeirrotfleisch USMember ✭✭✭

    @jezh That solves it for the Alarms List but then when I want to go to the Details (click item in EventList) the EventListItem no longer has its toolbar ...

    Regards

    M.R.

  • jezhjezh Member, Xamarin Team Xamurai

    You can create a new layout for this activity(the Details (click item in EventList)).

    Or just hide the toolbar in EventListActivity and display it in EventListItemActivity .

    android:visibility="gone"
    

    and

    android:visibility="visible"
    
  • meirrotfleischmeirrotfleisch USMember ✭✭✭

    @jezh :smile:

    I guess my challenge here is how/where are the two layouts being "combined"?

    Regards

    M.R.

  • meirrotfleischmeirrotfleisch USMember ✭✭✭

    @jezh thanks for all your hard work and help

    m.r.

  • jezhjezh Member, Xamarin Team Xamurai

    It's my pleasure to help you. Have a nice day. :)

Sign In or Register to comment.