关于布局文件layout_gravity的问题

Utopia 2012-02-22 07:52:53
我想在屏幕底部放3个imagebutton,做成左中右的布局,但是在tablerow中layout_gravity不起作用,
下面布局文件
<?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:background="#606060"
android:orientation="vertical" >

<RelativeLayout
android:id="@+id/head"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<ImageView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:contentDescription="@string/title"
android:src="@drawable/play"
/>

<ImageButton
android:id="@+id/playOrPause"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/music"
android:adjustViewBounds="true"
android:layout_gravity="right"
android:layout_toRightOf="@id/title"
android:src="@drawable/play"
/>
</RelativeLayout>

<FrameLayout
android:id="@+id/middlecontent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
>


</FrameLayout>


<TableLayout
android:id="@+id/flip"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>

<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>

<ImageButton
android:id="@+id/left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/left"
android:adjustViewBounds="true"
android:contentDescription="@string/leftye"
/>

<ImageButton
android:id="@+id/goContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_gravity="center"
android:contentDescription="@string/middle"
/>

<ImageButton
android:id="@+id/right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/right"
android:layout_gravity="right"
android:contentDescription="@string/rightye"
/>

</TableRow>

</TableLayout>
</LinearLayout>
...全文
150 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
mendax 2012-02-22
  • 打赏
  • 举报
回复
你的android:layout_gravity 表示按钮在tablerow界面上的位置把~~

80,350

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧