Android 放置另一个图元后剩余空间中的图元居中
在我的Android 放置另一个图元后剩余空间中的图元居中,android,Android,在我的android应用程序中,我有一个带有ImageView和两个微调器的工具栏。我希望图像视图与屏幕左侧齐平,两个微调器间隔均匀,水平居中于剩余空间(不是在屏幕上水平居中,而是在放置ImageView后的剩余空间中水平居中。实现这一点的最佳方法是什么? <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" > <ImageView
android
应用程序中,我有一个带有ImageView
和两个微调器的工具栏。我希望图像视图
与屏幕左侧齐平,两个微调器
间隔均匀,水平居中于剩余空间(不是在屏幕上水平居中,而是在放置ImageView
后的剩余空间中水平居中。实现这一点的最佳方法是什么?
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id\img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id\img"
android:orientation="vertical"
android:layout_gravity="center_horizontal" >
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</RelativeLayout>
相对布局固定图像和微调器(作为一个组)的相对位置。线性布局设置微调器,并通过设置布局重力使其在布局内水平居中
我假设你想要一个在另一个上面。如果你想要它们并排,改变方向