0

画面の上部に5つのボタンでナビゲーションバーを作成しようとしています。 ボタンのサイズを画面のサイズによって変わらず、画面の幅に合わせて拡大したいと思います。Androidで伸縮可能なナビゲーションバーを作成する方法

私が見つけた最も適切な解決策は、テーブルビューです。 問題は、テーブル行を1つしか持たず、リニアビューで画面の残りの部分を続ける方法が見つからないことです。

次の例では、EditTextがナビゲーションバーの直後ではなく、画面の下部に表示されます。

アイデア?

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

     <TableRow android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_weight="1" android:id="@+id/tableRow2"> 
      <Button android:layout_width="0dip" android:text="1" android:layout_weight="1" android:layout_height="wrap_content" android:id="@+id/n1"></Button> 
      <Button android:layout_width="0dip" android:text="2" android:layout_weight="1" android:layout_height="wrap_content" android:id="@+id/n2"></Button> 
      <Button android:layout_width="0dip" android:text="3" android:layout_weight="1" android:layout_height="wrap_content" android:id="@+id/n3"></Button> 
      <Button android:layout_width="0dip" android:text="4" android:layout_weight="1" android:layout_height="wrap_content" android:id="@+id/n4"></Button> 
      <Button android:layout_width="0dip" android:text="5" android:layout_weight="1" android:layout_height="wrap_content" android:id="@+id/n5" android:layout_margin="0"></Button> 
     </TableRow> 
     <EditText android:id="@+id/editText1" android:layout_height="wrap_content" android:layout_width="fill_parent" android:inputType="textPostalAddress"> 
      <requestFocus></requestFocus> 
     </EditText> 
</LinearLayout> 

答えて

0

TableLayout

あなたは相対的なレイアウトを使用する必要があり、それが画面サイズ自体を処理するレイアウトのようなタイプのためLinearLayout

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

     <LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    > 
      <Button android:layout_width="0dip" android:text="1" android:layout_weight="1" android:layout_height="wrap_content" android:id="@+id/n1"></Button> 
      <Button android:layout_width="0dip" android:text="2" android:layout_weight="1" android:layout_height="wrap_content" android:id="@+id/n2"></Button> 
      <Button android:layout_width="0dip" android:text="3" android:layout_weight="1" android:layout_height="wrap_content" android:id="@+id/n3"></Button> 
      <Button android:layout_width="0dip" android:text="4" android:layout_weight="1" android:layout_height="wrap_content" android:id="@+id/n4"></Button> 
      <Button android:layout_width="0dip" android:text="5" android:layout_weight="1" android:layout_height="wrap_content" android:id="@+id/n5" android:layout_margin="0"></Button> 
     </LinearLayout > 
     <EditText android:id="@+id/editText1" android:layout_height="wrap_content" android:layout_width="fill_parent" android:inputType="textPostalAddress"> 
      <requestFocus></requestFocus> 
     </EditText> 
</LinearLayout> 
0

を追加する必要はありません。

関連する問題