gpt4 book ai didi

android - 水平对齐4个imagebutton

转载 作者:行者123 更新时间:2023-11-30 03:06:09 24 4
gpt4 key购买 nike

我遇到了尝试在此布局中水平对齐 4 个图像按钮的问题。按钮应位于 admob 单元上方的底部。

如果可能的话,我需要一些方法来解决保留以前的布局元素的问题。

非常感谢大卫

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>

最佳答案

只需在 ImageButtons 周围使用方向为 水平LinearLayout

关于android - 水平对齐4个imagebutton,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21787160/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com