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
<LinearLayoutandroid:layout_width="fill_parent"android:layout_height="fill_parent"android:orientation="vertical" ><TextViewandroid: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><ListViewandroid:id="@android:id/list"android:layout_width="fill_parent"android:layout_height="0dp"android:layout_weight="1"/><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content" ><TextViewandroid: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" /><Buttonandroid: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" /><EditTextandroid: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 :
<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent"android:layout_height="fill_parent" ><Buttonandroid:id="@+id/SubmitButton"... /><LinearLayoutandroid: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"