Android linearlayout on relativelayout makes relative disappear -
i have linearlayout listview in relativelayout. listview visible, parent 2 buttons , textview not. cannot figure out why. tried setting linearlayout bottom with
android:layout_alignparentbottom="true" but did not work, can tell me why can see listview , nothing else.
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <textview android:id="@+id/date" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_centerinparent="true" /> <button android:id="@+id/exercise" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/date" android:text="@string/exercise" android:onclick="tostat" /> <button android:id="@+id/summary" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/date" android:layout_torightof="@id/exercise" android:text="@string/summary" android:onclick="totraining" /> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/blue"> <listview android:id="@+id/listview" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerhorizontal="true" android:layout_margintop="10dp" android:stretchmode="columnwidth" android:gravity="center" /> </linearlayout> </relativelayout>
its because have not mentioned linearlayout should below summary button. hence overlapping textview , buttons. add android:layout_below="@id/summary" in linearlayout. mention linear layout height wrap_content.
<linearlayout android:layout_below="@id/summary" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/blue"> <listview android:id="@+id/listview" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerhorizontal="true" android:layout_margintop="10dp" android:stretchmode="columnwidth" android:gravity="center" /> </linearlayout>
Comments
Post a Comment