-1

I am unable to put button at bottom of this Screen. The listview should come on top while sign out button must appear at bottom just after the list view ends.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="top"
android:background="#29A586">
<Button
    android:text="Sign Out"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/SignOutButton" />

<ListView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/mylistView" />
</LinearLayout>
NIshank
  • 97
  • 6

1 Answers1

2

use button below listview with weight

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="top"
    android:background="#29A586">
    <ListView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:id="@+id/mylistView" />
    <Button
        android:text="Sign Out"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/SignOutButton" />
    </LinearLayout>
  • Hey Muhammed , It is rendering correctly in XAML designer but app is getting crashed when I navigate to that screen. – NIshank Mar 29 '19 at 11:33
  • @NIshank i don't know why it'c crashing but the xml will work fine bcz i test it.. share your crash here – Muhammad Imran Mar 29 '19 at 11:35
  • Getting => Android.Views.InflateException: whenever I navigating to that screen. – NIshank Mar 29 '19 at 11:41
  • @NIshank check [Here](https://forums.xamarin.com/discussion/124053/android-views-inflateexception-timeout-exceeded-getting-exception-details) also [here](https://stackoverflow.com/questions/49344884/xamairin-forms-android-views-inflateexception-timeout-exceeded-getting-excep) – Muhammad Imran Mar 29 '19 at 11:43