2012-02-02 2 views
0

Я пытаюсь создать представление с 2-мя кнопками сверху (1 на левой стороне экрана и другой с правой стороны), наложение наложения между ними и другая кнопка внизу справа от экрана. Здесь правая верхняя кнопка не помещаются на право .. пожалуйста, помогите .. вот мой кодРазмещение кнопки справа в android

<?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

Попробуйте использовать RelativeLayout с layout_alignParentLeft и layout_alignParentRight как таковой:

<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 на ваш вопрос, почему вы не можете установить верхнюю правую кнопку изображения. Чтобы заставить его работать, измените свой код в соответствии с приведенным здесь ответом Ника. :)