My TextView is aligning verticaly to the center of Layout, but I want it to be aligned to top, as it has to be header for ListView. I tried to put it in inner RelativeLayout, but it doesnt't help. My Layout.xml:
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/re/android"xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <RelativeLayout android:id="@+id/header" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:background="#FC9" android:gravity="center" > <TextView android:id="@+id/main_activity_header" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="20dp" android:text="@string/header_main_activity" android:background="#3F51B5" android:textColor="#FFFFFF" /> </RelativeLayout> <ListView android:id="@+id/menu" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_below="@id/header" > </ListView> </RelativeLayout> In editor everything looks good, but, when I run my app on the device and list isn't fully populated, my TextView together with ListView aligns to the vertical center.
What I have to do to make it align to top of the layout?
No comments:
Post a Comment