Android 堆叠两个图像按钮
我有两个ImageButton,我正试图将一个堆叠在另一个之上。我基本上想要制作一个有两个大按钮的屏幕,每个按钮占据50%的可用空间。代码如下。这里是一个布局的捕获,它产生了我已经玩过布局_重力和家长重力。设置两个孩子的布局高度=填充父对象不起作用,将父对象的重力设置为垂直填充也不起作用Android 堆叠两个图像按钮,android,layout,imageview,imagebutton,android-linearlayout,Android,Layout,Imageview,Imagebutton,Android Linearlayout,我有两个ImageButton,我正试图将一个堆叠在另一个之上。我基本上想要制作一个有两个大按钮的屏幕,每个按钮占据50%的可用空间。代码如下。这里是一个布局的捕获,它产生了我已经玩过布局_重力和家长重力。设置两个孩子的布局高度=填充父对象不起作用,将父对象的重力设置为垂直填充也不起作用 <!-- Notes tab --> <LinearLayout android:id="@+id/tabNotes" androi
<!-- Notes tab -->
<LinearLayout android:id="@+id/tabNotes"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="6dp"
android:orientation="vertical">
<ImageButton android:src="@drawable/ic_btn_speak_now" android:id="@+id/imgSpeakNow"
android:background="#FFFF00"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<ImageButton android:src="@drawable/ic_btn_compose" android:id="@+id/imgCompose"
android:background="#FF00FF"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
使用android:layout\u weight;将两个按钮设置为具有相同的值 使用RelativeLayout而不是LinearLayout也可能有所帮助