0

いつか私はこれらのAndroidレイアウトのコードを解読するでしょう。はぁ

画面の上部に固定されたTextView、その下にスクロール可能なリストビュー、画面の下部に固定されたeditTextとボタン(ユーザーがアイテムを追加できるようにするためのアイデア)を使用したアクティビティが必要です。リスト)。

質問として以下の作業コードが回答されました:

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

     <TextView
         android:id="@+id/tvAddQuizWordQuizName"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content" 
         android:layout_alignParentTop="true"
         android:text="Quiz Name" 
         android:textSize="26dip"
         />

     <ListView 
         android:layout_width="fill_parent"
         android:layout_height="wrap_content" 
         android:id="@+id/list"
         android:layout_below="@+id/tvAddQuizWordQuizName"
         android:layout_above="@+id/bottomArea"
         />

     <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
         xmlns:tools="http://schemas.android.com/tools"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_alignParentBottom="true"
         android:id="@+id/bottomArea"
         >
         <EditText
             android:id="@+id/etAddQuizWord"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_toLeftOf="@+id/btnAddQuizWord"
             android:textColor="@android:color/black" 
             android:inputType="textNoSuggestions"
             android:hint="Enter quiz word..."
             android:textSize="32dip"
             android:layout_alignParentLeft="true"
             android:background="#0000ff"
             >
         </EditText>

         <Button
             android:text="Add"
             android:id="@+id/btnAddQuizWord"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:textSize="20dip"
             android:textStyle="bold"
             android:gravity="center"
             android:layout_alignParentRight="true" 
             android:onClick="AddButtonClicked"
             />
     </RelativeLayout>

 </RelativeLayout>

問題は、lopのtextviewとlistViewが表示されていないことです。とてもシンプルなことだと思いますが、うまくいきません。

4

1 に答える 1

0

以下のレイアウトは、要素を希望どおりに配置する必要があります。

<RelativeLayout >

    <TextView android:id="@+id/ttvAddQuizWordQuizName"
         android:layout_alignParentTop="true"
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" />

    <RelativeLayout android:id="@+id/InnerRelativeLayout"     
         android:layout_alignParentBottom="true" 
         android:layout_width="match_parent"
         android:layout_height="wrap_content" >
         <!-- contebt here -->
    </RelativeLayout>

     <ListView 
         android:layout_width="match_parent"
         android:layout_height="wrap_content" 
         android:id="@+id/list"
         android:layout_above="@id/InnerRelativeLayout"
         android:layout_below="@id/tvAddQuizWordQuizName" />

 </RelativeLayout>
于 2012-09-30T13:44:06.820 に答える