Satheesh
Satheesh

Reputation: 1730

Edittext not visible

In my application I have 3 buttons and one listView and one editText with image. My problem is that when I am editing task in my editText the size of the editText is reduced very much.This problem occurs only on mobile. Please help me. enter image description here This is my layout file:

    <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="10" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:layout_weight="1"
        android:orientation="horizontal"
        android:weightSum="30" >

        <Button
            android:id="@+id/todaytaskbtnid"
            style="?android:attr/buttonStyleSmall"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="10"
            android:background="@drawable/buttonselector"
            android:gravity="center"
            android:text="TODAY" />

        <Button
            android:id="@+id/tomorrowtaskbtnid"
            style="?android:attr/buttonStyleSmall"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="10"
            android:background="@drawable/buttonselector"
            android:text="TOMORROW" />

        <Button
            android:id="@+id/futuretaskbtnid"
            style="?android:attr/buttonStyleSmall"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="10"
            android:background="@drawable/buttonselector"
            android:text="FUTURE" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:layout_weight="8" >

        <ListView
            android:id="@+id/frontpagetasklistid"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" >
        </ListView>
    </LinearLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:layout_weight="1"
        android:orientation="horizontal" >

        <EditText
            android:id="@+id/edittextidAddTodayTask"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:background="@drawable/edittextselector"
            android:drawableRight="@drawable/addtask"
            android:hint="Add Today Task"
            android:lines="3"
            android:maxLines="5"
            android:minLines="1" />
    </LinearLayout>

</LinearLayout>

Mobile shot: enter image description here

Upvotes: 1

Views: 5564

Answers (4)

IncrediApp
IncrediApp

Reputation: 10363

I believe you shouldn't use layout weights in this situtation or you've mixed them. You can leave the linear layouts with the weights for the rows, but since you want the edit text to appear at the bottom of the screen, what I would do is wrap everything in a RelativeLayout, then draw the edit text and align it to the parent's bottom and then put the linear layout aligned to be above the edit text.

Try this layout (and of course, don't forget to change the drawables to your drawables since I removed some of them):

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

        <EditText
            android:id="@+id/edittextidAddTodayTask"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:drawableRight="@drawable/addtask"
            android:hint="Add Today Task"
            android:lines="3"
            android:maxLines="5"
            android:minLines="1" />


    <LinearLayout
        android:id="@+id/topButtons"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_alignParentTop="true"
        android:weightSum="30" >

        <Button
            android:id="@+id/todaytaskbtnid"
            style="?android:attr/buttonStyleSmall"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="10"
            android:gravity="center"
            android:text="TODAY" />

        <Button
            android:id="@+id/tomorrowtaskbtnid"
            style="?android:attr/buttonStyleSmall"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="10"
            android:text="TOMORROW" />

        <Button
            android:id="@+id/futuretaskbtnid"
            style="?android:attr/buttonStyleSmall"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_weight="10"
            android:text="FUTURE" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_above="@id/edittextidAddTodayTask"
        android:layout_below="@id/topButtons"
         >

        <ListView
            android:id="@+id/frontpagetasklistid"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" >
        </ListView>
    </LinearLayout>


</RelativeLayout>

Upvotes: 2

Saikat Das
Saikat Das

Reputation: 95

What about reducing weigght for the listview while increasing weight for the edit text linear layout?This will enhance the size of your edit text.I Dont think your xml code for your edit text needs any weight because it fills parent layout.

Upvotes: 0

Mandar Limaye
Mandar Limaye

Reputation: 1910

You need to make sure your <activity> tag in AndroidManifest.xml does not have a configChanges attribute like this : android:configChanges="keyboard|keyboardHidden|orientation"

This will redraw activity when keyboard is shown or orientation changes. http://developer.android.com/guide/topics/manifest/activity-element.html#config

Upvotes: -1

Rumit Patel
Rumit Patel

Reputation: 12619

try giving EditText's android:layout_height="0dp"

Upvotes: 0

Related Questions