Reputation: 163
So, I'm developing an application that have a Listview, an EditText and a Button below the ListView. Like this printscreen:
The problem is: When I click in the EditText, the EditText rises and stay ahead my Listview, like this printscreen:
In my Mainfest I already add the windowSoftInputMode="AdjustResize" and windowSoftInputMode="adjustPan" and any works.
This is my XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="400dp"
android:layout_height="match_parent"
tools:context=".MainActivity">
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:ems="10"
android:id="@+id/editText"
android:hint="Senha"
android:textColor="#000000"
android:layout_marginBottom="22dp"
android:layout_above="@+id/button"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Conectar"
android:id="@+id/button"
android:textColor="#000000"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="39dp" />
<ListView
android:layout_width="330dp"
android:layout_height="260dp"
android:id="@+id/listView"
android:background="@drawable/border"
android:stackFromBottom="true"
android:transcriptMode="normal"
android:layout_marginLeft="63dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
Can anyone help me with this problem? Thanks for any help guys!
Upvotes: 0
Views: 340
Reputation: 6140
Try This. And Add margin according to your need.
I tested this in my mobile.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/border" >
</ListView>
</LinearLayout>
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="22dp"
android:ems="10"
android:hint="Senha"
android:inputType="textPassword"
android:textColor="#000000" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="39dp"
android:text="Conectar"
android:textColor="#000000" />
</LinearLayout>
Upvotes: 1
Reputation: 352
add RequestFocus below This snippet
<ListView
android:layout_width="330dp"
android:layout_height="260dp"
android:id="@+id/listView"
android:background="@drawable/border"
android:stackFromBottom="true"
android:transcriptMode="normal"
android:layout_marginLeft="63dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<RequestFocus/>
</Relativelayout>
Upvotes: 0