【问题标题】:Android TableRow positioningAndroid TableRow定位
【发布时间】:2011-09-04 15:57:34
【问题描述】:

我想为我的游戏制作一种武器选择器。它将由左箭头、武器图像和右箭头组成。

我的做法是这样的:

<?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:gravity 有“bottom”和“center_horizo​​ntal”属性,但底部中心没有。有人知道怎么做吗?

【问题讨论】:

  • 当你同时检查“bottom”和“center_horizo​​ntal”时,它会变成android:layout_gravity="bottom|center_horizontal"

标签: android eclipse


【解决方案1】:

你应该可以像这样android:gravity="bottom|center_horizontal" 将两者结合起来

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-19
    • 2011-01-06
    • 2014-10-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多