2012-03-03 8 views
2

ボタンを画面の両側で一番下に配置する方が良いでしょうか?重要な部分は、RelativeLayoutでのみ使用できるように見えるalignParentBottomと、LinearLayoutおよびRelativeLayoutが1でないTableLayoutのようなサブクラスでのみ使用できるように見えるlayout_gravityです。ボトムアライメントされたボタンのレイアウト

<RelativeLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true"> 
     <TableLayout 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:stretchColumns="1"> 
      <TableRow> 
       <Button 
        android:id="@+id/list_delete" 
        android:text="@string/list_delete" 
        android:visibility="invisible" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        /> 
       <Button 
        android:id="@+id/list_save" 
        android:text="@string/list_add" 
        android:layout_gravity="right" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        /> 
      </TableRow> 
     </TableLayout> 
    </RelativeLayout> 

のAndroid lintは私にこのようなエラーを与えている:

  • このTableLayoutのレイアウトやそのRelativeLayoutの親が
  • 無用であるこののTableRowのレイアウトやそのTableLayoutの親は無用

答えて

4

てみていますこの

<RelativeLayout//this will be your parent layout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    > 


      <Button 
       android:id="@+id/list_delete" 
       android:text="@string/list_delete" 
       android:visibility="invisible" 
       android:layout_alignParentBottom="true" 
       android:layout_alignParentLeft="true" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       /> 
      <Button 
       android:id="@+id/list_save" 
       android:text="@string/list_add" 
       android:layout_alignParentBottom="true" 
       android:layout_alignParentRight="true" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       /> 


</RelativeLayout> 
関連する問題