2014-02-14 136 views
1

我有probs試圖水平對齊4個圖像按鈕這種佈局。這些按鈕應位於admob單元的底部。水平對齊4圖像按鈕

我需要一些方法來解決,保持以前的佈局要素,如果可能的話。

非常感謝大衛

No description

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="#CC000000" 
    android:divider="?android:attr/listDivider" 
    android:orientation="vertical" 
    android:showDividers="middle" > 


    <FrameLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     android:background="#CC000000" 
     android:divider="?android:attr/listDivider" 
     android:orientation="vertical" 
     android:showDividers="middle" > 

     <ImageView 
      android:id="@+id/fondo" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:src="@drawable/fondo" > 
     </ImageView> 

     <RelativeLayout 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:layout_gravity="center_horizontal" 
      android:orientation="horizontal" > 

      <ImageView 
       android:id="@+id/calendar" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentTop="true" 
       android:layout_centerHorizontal="true" 
       android:src="@drawable/calendar" > 
      </ImageView> 

      <TextView 
       android:id="@+id/mes" 
       android:layout_width="wrap_content" 
       android:layout_height="match_parent" 
       android:layout_marginTop="10dp" 
       android:layout_alignParentBottom="true" 
       android:layout_centerHorizontal="true" 
       android:textColor="#ffffff" 
       android:textStyle="bold" 
       android:textSize="16sp" > 
      </TextView> 

      <TextView 
       android:id="@+id/dia" 
       android:layout_width="wrap_content" 
       android:layout_height="match_parent" 
       android:layout_marginTop="40dp" 
       android:layout_alignParentBottom="true" 
       android:layout_centerHorizontal="true" 
       android:textStyle="bold" 
       android:textColor="#000000" 
       android:textSize="40sp" > 
      </TextView> 
     </RelativeLayout> 

     <RelativeLayout 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:layout_gravity="center_horizontal" 
      android:layout_marginTop="130dp" 
      android:orientation="horizontal" > 

      <!-- scrolling bottom pane --> 

      <ScrollView 
       android:id="@+id/scrollView1" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginBottom="40dp" 

       android:background="@drawable/scroll" 
       android:padding="@dimen/activity_horizontal_margin" > 

       <LinearLayout 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:orientation="vertical" > 

        <TextView 
         android:id="@+id/etResponse" 
         android:layout_width="match_parent" 
         android:layout_height="match_parent" 
         android:layout_weight="1" 
         android:textColor="#ffffff" 
         android:textSize="20sp" > 
        </TextView> 
       </LinearLayout> 
      </ScrollView> 

      <ImageButton 
       android:id="@+id/gp" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentBottom="true" 
       android:layout_alignParentRight="true" 
       android:layout_marginRight="54dp" 
       android:background="@drawable/rounded" 
       android:src="@drawable/gp" /> 

      <ImageButton 
       android:id="@+id/wa" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentBottom="true" 
       android:layout_toLeftOf="@+id/gp" 
       android:background="@drawable/rounded" 
       android:src="@drawable/wa" /> 

      <ImageButton 
       android:id="@+id/fb" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentBottom="true" 
       android:layout_alignParentLeft="true" 
       android:layout_marginLeft="54dp" 
       android:layout_toLeftOf="@+id/tw" 
       android:background="@drawable/rounded" 
       android:src="@drawable/fb" /> 

      <ImageButton 
       android:id="@+id/tw" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignParentBottom="true" 
       android:layout_toLeftOf="@+id/wa" 
       android:background="@drawable/rounded" 
       android:src="@drawable/tw" /> 

     </RelativeLayout> 

    </FrameLayout> 

    <com.google.ads.AdView 
     android:id="@+id/adView" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     ads:adSize="BANNER" 
    </com.google.ads.AdView> 

</LinearLayout> 

回答

1

只需使用一個LinearLayout與方向horizontal角落找尋ImageButtons