0

私は新しいアンドロイド開発です。以下に私のレイアウトファイルを添付します。

私のレイアウトではListView、1つと1つEditTextがありImageButtonます。タスクを挿入しEditTextて押すと、そのタスクが1つずつImageButton追加されます。ListView

私の問題は、4つ以上のタスクを追加すると、リストアイテムがその場所にあるため、 EditTextwithビューが表示されないことを意味し、解決策を教えてください...ImageButton

レイアウト:

     <LinearLayout 
         android:layout_width="fill_parent"
         android:layout_height="wrap_content">

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

        </ListView>
        </LinearLayout>
        <LinearLayout 
         android:layout_width="fill_parent"
         android:layout_height="wrap_content">

        <RelativeLayout 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            >
        <EditText 
            android:id="@+id/edittextidAddTodayTask"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:background="@drawable/edittextselector"
            android:hint="Add Today Task"/>

        <ImageButton
            android:id="@+id/imagebuttonidAddTodayTask"
            android:layout_width="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:src="@drawable/addtask" />

        </RelativeLayout>
        </LinearLayout>

    </LinearLayout>
4

5 に答える 5

1

これを試して:

      <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
       android:layout_width="match_parent"
       android:layout_height="match_parent" >

      <RelativeLayout 
        android:id="@+id/button_layout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        >

    <EditText 
        android:id="@+id/edittextidAddTodayTask"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="@drawable/edittextselector"
        android:hint="Add Today Task"/>

    <ImageButton
        android:id="@+id/imagebuttonidAddTodayTask"
        android:layout_width="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_height="wrap_content"
        android:layout_gravity="right"
        android:src="@drawable/addtask" />

 </RelativeLayout>
 <ListView
    android:id="@+id/frontpagetasklistid"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:layout_above="@+id/button_layout">

</ListView>

</RelativeLayout>

また

  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="match_parent"
   android:layout_height="match_parent" >

   <ListView
    android:id="@+id/frontpagetasklistid"
    android:layout_width="fill_parent"
    android:layout_height="0dp"         
    android:layout_weight="1"
    android:layout_above="@+id/button_layout">

   </ListView>  

   <RelativeLayout 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        >
    <EditText 
        android:id="@+id/edittextidAddTodayTask"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="@drawable/edittextselector"
        android:hint="Add Today Task"/>

    <ImageButton
        android:id="@+id/imagebuttonidAddTodayTask"
        android:layout_width="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_height="wrap_content"
        android:layout_gravity="right"
        android:src="@drawable/addtask" />

 </RelativeLayout>


</LinearLayout>
于 2013-07-09T05:39:41.857 に答える
0

edittext と imagebutton がリストビューの下にあると推測しています..その場合、リストビューのフッターにこのビューを追加できます..リストビューのフッターにビューを追加する方法をグーグルで検索できます

ここに良い例があります: 相対レイアウトでボタンと EditText を揃える

それがあなたを助けることを願っています!!

于 2013-07-09T04:57:40.807 に答える
0

以下のソリューションは実行していませんが、プロパティを使用して実現できlayout_weightSumますlayout_weight

<?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:layout_weigthSum="1">

     <LinearLayout 
         android:layout_width="fill_parent"
         android:layout_height="0dp"
         android:layout_weight="0.9">

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

        </ListView>
        </LinearLayout>
        <LinearLayout 
         android:layout_width="fill_parent"
         android:layout_height="0dp"
         android:layout_weight="0.1">

        <RelativeLayout 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            >
        <EditText 
            android:id="@+id/edittextidAddTodayTask"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:background="@drawable/edittextselector"
            android:hint="Add Today Task"/>

        <ImageButton
            android:id="@+id/imagebuttonidAddTodayTask"
            android:layout_width="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:src="@drawable/addtask" />

        </RelativeLayout>
        </LinearLayout>

    </LinearLayout>
于 2013-07-09T04:57:56.840 に答える