如何制作一个总是位于屏幕底部的按钮,如下图

hshm20517 2010-08-26 06:02:17



...全文
2681 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
madanhui19920914 2011-11-09
  • 打赏
  • 举报
回复
includ
RelativeLayout 里面android:layout_alignParentBottom=“true”
程序员长弓 2011-09-21
  • 打赏
  • 举报
回复
试试啊
CheryStrive 2010-09-02
  • 打赏
  • 举报
回复
使用RelativeLayout即可。
多鱼的夏天 2010-09-02
  • 打赏
  • 举报
回复
把两个button放入相对布局RelativeLayout,再设置button属性android:layout_alignParentBottom="true"
xiongjw 2010-09-01
  • 打赏
  • 举报
回复
把那2个button单独写个布局,然后include进主布局,在单独的布局中设置android:layout_alignParentBottom=“true”,他就一直在下面了
bigpretty 2010-09-01
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 yyy025025025 的回复:]
1.采用linearlayout布局:

Java code
<LinearLayout
android:id="@+id/main"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientatio……
[/Quote]
+1 就这样拉.布局的时候多动手写写
tonyzzp 2010-08-31
  • 打赏
  • 举报
回复
android sdk里自带的例子里面有 GestureBuilder


F:\android-sdk-windows\samples\android-7\GestureBuilder
hottymg 2010-08-31
  • 打赏
  • 举报
回复
学习了~
yyy025025025 2010-08-26
  • 打赏
  • 举报
回复
1.采用linearlayout布局:
    <LinearLayout
android:id="@+id/main"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<LinearLayout
android:id="@+id/content"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical"
/>

<LinearLayout
android:id="@+id/bottom_panel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<Button
android:id="@+id/done"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:text="done"
/>
<Button
android:id="@+id/revert"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:text="revert"
/>
</LinearLayout>
</LinearLayout>



2. 采用relativelayout布局:
    <RelativeLayout
android:id="@+id/main"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:id="@+id/content"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
/>

<LinearLayout
android:id="@+id/bottom_panel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
>
<Button
android:id="@+id/done"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:text="done"
/>
<Button
android:id="@+id/revert"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:text="revert"
/>
</LinearLayout>
</RelativeLayout>
sharkdoodoo 2010-08-26
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 standatw 的回复:]
Java code
RelativeLayout
[/Quote]

相对布局嘛...

用相对定位
charles_lc 2010-08-26
  • 打赏
  • 举报
回复
RelativeLayout
纠结的木棉花 2010-08-26
  • 打赏
  • 举报
回复
它好像是把button放在一个单独的布局中去的,外面有个类似表格的东西限制着

80,337

社区成员

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

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