Android RelativeLayout Overlapping
I've a relative layout in android for a chat application.The problem is that the listview on my screen when grows the last elements are hidden behind the textbox and button which I
Solution 1:
what you want to do is in the LinearLayout
do android:layout_above="@+id/Chatbox"
that will make sure it does not go below it
Solution 2:
//try this its working fine for me
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/PreviousChatsButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:gravity="center_horizontal"
android:padding="5dip"
android:text="ViewPreviousChats" >
</TextView>
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/NoChatsMsg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="@string/NoNewChatMsg" />
<Button
android:id="@+id/SubmitButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:onClick="SubmitButtonClick"
android:text="@string/Submit" />
<EditText
android:id="@+id/Chatbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@id/SubmitButton"
android:layout_alignBottom="@id/SubmitButton"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@id/SubmitButton"
android:ems="10"
android:inputType="text" >
</EditText>
</LinearLayout>
</LinearLayout>
Solution 3:
Use android:layout_above
to avoid this problem :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<Button
android:id="@+id/SubmitButton" ... />
<LinearLayout
android:layout_above="@id/SubmitButton" ... >
...
</LinearLayout>
Note that you have to declare your button before the LinearLayout for this to work.
Post a Comment for "Android RelativeLayout Overlapping"