首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安卓TableRow定位

安卓TableRow定位
EN

Stack Overflow用户
提问于 2011-05-30 16:34:16
回答 1查看 1.8K关注 0票数 0

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

我的方法是这样的:

代码语言:javascript
复制
<?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”属性:重力,但没有底部中心的属性。有人知道怎么做吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-05-30 16:43:09

您应该能够像这样将两个android:gravity="bottom|center_horizontal"组合在一起

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6174009

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档