Reputation: 155
I have a layout where I want the ListView to be at the bottom of the screen on every device. On the Android Studio preview it looks fine, but on my device it looks like this:
When it should look like this:
Code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:id="@+id/imageView"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="65dp"
android:src="@drawable/test"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Full Name"
android:id="@+id/textView"
android:layout_below="@+id/imageView"
android:layout_centerHorizontal="true"
android:paddingTop="7dp"
android:textStyle="bold"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="University"
android:id="@+id/textView2"
android:layout_below="@+id/textView"
android:layout_centerHorizontal="true" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/textView2" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button2"
android:layout_alignTop="@+id/button"
android:layout_toRightOf="@+id/textView" />
<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/customList"
android:layout_below="@+id/textView"
android:layout_centerHorizontal="true"
android:layout_marginTop="95dp" />
</RelativeLayout>
Upvotes: 0
Views: 497
Reputation: 4008
Well take your three button in one layout say yourButtonContainer
and you can have listview with property
android:layout_alignParentBottom="true"
along with the property
android:layout_below="@+id/yourButtonContainer"
Upvotes: 1