我想为我的游戏做一个武器选择器。它将由一个左箭头、武器图像和一个右箭头组成。
我的方法是这样的:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical">
<TableRow android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="bottom" android:orientation="horizontal">
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:src="@drawable/larrow"
android:id="@+id/img_larrow" />
<ImageView android:layout_height="wrap_content"
android:layout_width="wrap_content" android:src="@drawable/ak47"
android:id="@+id/img_ak47" />
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:src="@drawable/rarrow"
android:id="@+id/img_rarrow" />
</TableRow>
问题是,我想把它放在底部-中心。到目前为止,我只能通过TableRow的android:gravity属性将其定位在底部或顶部的中心。android有" bottom“和"center_horizontal”属性:重力,但没有底部中心的属性。有人知道怎么做吗?
发布于 2011-05-30 16:43:09
您应该能够像这样将两个android:gravity="bottom|center_horizontal"组合在一起
https://stackoverflow.com/questions/6174009
复制相似问题