2012-02-02 6 views
0

私は、上に2つのボタン(画面の左側と右側に1つずつ)、ジェスチャーオーバーレイとその下の別のボタンでビューを作成しようとしています画面の右側に表示されます。ここで 右上のボタンが右側に配置されていない..助けてください.. をここに私のコードですアンドロイドの右側にボタンを配置する

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="#ffffff" 
    > 
<LinearLayout android:layout_height="wrap_content" 
android:layout_width="match_parent" 
android:id="@+id/linearLayout1"> 
    <ImageButton android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    android:background="@drawable/add" 
    android:id="@+id/bBlog"></ImageButton> 
    <ImageButton android:layout_height="wrap_content" 
android:layout_width="wrap_content" android:layout_gravity="right" android:background="@drawable/view" android:id="@+id/bBlog"></ImageButton> 
</LinearLayout> 

<RelativeLayout android:layout_height="fill_parent" android:layout_width="match_parent"> 

    <android.gesture.GestureOverlayView android:layout_alignParentRight="true" 
    android:id="@+id/myoverlay" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:gestureColor="#000333"/> 
    <ImageButton android:layout_alignParentRight="true" 
    android:layout_alignParentBottom="true" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:background="@drawable/icon" 
    android:id="@+id/exit"></ImageButton> 
</RelativeLayout> 
</LinearLayout> 

答えて

0

などlayout_alignParentLeftやlayout_alignParentRightとRelativeLayoutを使用してみてください:

<RelativeLayout android:layout_height="wrap_content" 
     android:layout_width="match_parent" 
     android:id="@+id/linearLayout1"> 
     <ImageButton 
      android:layout_height="wrap_content" 
      android:layout_width="fill_parent" 
      android:src="@drawable/add" 
      android:layout_alignParentLeft="true" 
      android:id="@+id/bBlog"> 
     </ImageButton> 
     <ImageButton 
      android:layout_height="fill_parent" 
      android:layout_width="wrap_content" 
      android:src="@drawable/view" 
      android:layout_alignParentRight="true" 
      android:id="@+id/bBlog"> 
     </ImageButton> 

もちろん、必要に応じて埋め込みを追加することもできます。

+0

ありがとう –

0

thisの回答を確認して、なぜあなたは右上の画像ボタンを設定できないのかを確認してください。それがうまくいくためには、ここで与えられたNickの回答に従ってコードを変更してください。 :)

関連する問題