0

i have the following layout

<LinearLayout android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android">
        <ListView
            android:id="@+id/displaysms_listView1"
            android:layout_width="fill_parent"                        
            android:layout_height="319dp" />    
        <EditText
            android:id="@+id/displaysms_textView1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Write Message"
            android:inputType="textVisiblePassword" />
        <RelativeLayout
            android:id="@+id/displaysms_relativeLayout2"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" >
            <Button
                android:id="@+id/displaysms_btn_send"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"                    
                android:gravity="fill_vertical"
                android:text="Send"
                android:textSize="12sp" />
            <Button
                android:id="@+id/displaysms_btn_clear"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_alignParentTop="true"
                android:gravity="fill_vertical"
                android:text="Clear"
                android:textSize="12sp" />
      </RelativeLayout>    
</LinearLayout>

i have done adjustPan in the manifest file and it works fine on devices except samsung galaxy the EditText hides under the soft keyboard, any suggestions, i just want a EditText and buttons at the bottom of my list view

my Activity looks like

<activity
            android:name="com.SMSActivity"
             android:windowSoftInputMode="adjustPan|adjustResize"
Dakait
  • 2,531
  • 1
  • 25
  • 43

3 Answers3

4

u can do something like this

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:weightSum="100" >

    <ListView
        android:id="@+id/displaysms_listView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="20" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:layout_weight="80"
        android:focusableInTouchMode="true"
        android:padding="5dp"
        android:orientation="vertical" >

        <EditText
            android:id="@+id/displaysms_textView1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Write Message"
            android:inputType="textVisiblePassword" />

        <FrameLayout
           android:id="@+id/FrameLayout1"
           android:layout_width="fill_parent"
           android:layout_height="wrap_content" >

           <Button
               android:id="@+id/displaysms_btn_send"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:layout_gravity="left|center_vertical"
               android:padding="5dp"
               android:text="Send"
               android:textAppearance="?android:attr/textAppearanceMedium" />

           <Button
               android:id="@+id/displaysms_btn_clear"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:layout_gravity="right|center_vertical"
               android:padding="5dp"
               android:text="Clear"
               android:textAppearance="?android:attr/textAppearanceMedium" />
      </FrameLayout>
    </LinearLayout>

</LinearLayout>

in ur manifest file

<activity
    android:name="com.SMSActivity"
    android:windowSoftInputMode="adjustResize" />

Take a look for ref

Community
  • 1
  • 1
Kaushik
  • 6,150
  • 5
  • 39
  • 54
  • just one more thing the buttons are appearing too small the text is cutting off... – Dakait Dec 09 '13 at 12:58
  • if u have only 2 button u can use **FrameLayout** instead of **RelativeLayout** give little padding for both button i hav updated my answer – Kaushik Dec 09 '13 at 13:06
3
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >

<RelativeLayout
    android:id="@+id/displaysms_relativeLayout1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true" >

    <ListView
        android:id="@+id/displaysms_listView1"
        android:layout_width="fill_parent"
        android:layout_height="319dp"
        android:layout_margin="5dp" />

    <EditText
        android:id="@+id/displaysms_textView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/displaysms_listView1"
        android:layout_margin="5dp"
        android:hint="Write Message"
        android:inputType="textVisiblePassword" />
</RelativeLayout>

<RelativeLayout
    android:id="@+id/displaysms_relativeLayout2"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_below="@+id/displaysms_relativeLayout1" >

    <Button
        android:id="@+id/displaysms_btn_send"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:text="Send"
        android:textSize="12sp" />

    <Button
        android:id="@+id/displaysms_btn_clear"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:text="Clear"
        android:textSize="12sp" />
</RelativeLayout>

Srikanth Pai
  • 926
  • 3
  • 17
  • 30
1

try doing editText.requestFocus()

Abhishek Shukla
  • 1,242
  • 8
  • 11