0

私のアプリケーションには、3 つのボタンと 1 つの listView と 1 つの editText と画像があります。私の問題は、editText でタスクを編集しているときに、editText のサイズが大幅に縮小されることです。この問題はモバイルでのみ発生します。私を助けてください。 ここに画像の説明を入力 これは私のレイアウトファイルです:

    <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>

モバイルショット: ここに画像の説明を入力

4

4 に答える 4

2

この状況では、レイアウトの重みを使用しないでください。または、それらを混在させています。行のウェイトを使用して線形レイアウトのままにすることもできますが、編集テキストを画面の下部に表示したいので、すべてを RelativeLayout でラップし、編集テキストを描画して、親の下部を配置し、線形レイアウトを編集テキストの上に配置します。

このレイアウトを試してください (もちろん、ドローアブルの一部を削除したので、ドローアブルを自分のドローアブルに変更することを忘れないでください):

<?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>
于 2013-07-13T13:26:21.870 に答える
0

編集テキストの線形レイアウトの重みを増やしながら、リストビューの重みを減らすのはどうですか?これにより、編集テキストのサイズが大きくなります.編集テキストのxmlコードは、親レイアウトを埋めるため、重みが必要ないと思います.

于 2013-07-13T13:08:33.717 に答える