如何在屏幕底部显示小部件

Vermaraj

如何在屏幕底部显示小部件按钮。

我想在屏幕底部显示“发送”按钮

附上截图:

在此处输入图片说明

以下是布局xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/LinearLayout2"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="16dp"
    android:paddingRight="16dp"
    android:orientation="vertical" >

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content" 
        android:hint="@string/to"/>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content" 
        android:hint="@string/subject"/>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content" 
        android:hint="@string/message"/>

    <Button
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:text="@string/send"/>

</LinearLayout>

选中上方的按钮(发送),我想在屏幕底部显示此按钮。我该怎么办。我已将android:layout_gravity = 0.0用于按钮小部件,但不起作用。

神秘魔术师ϡ

轻松使用相对布局而不是LinearLayout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/LinearLayout2"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="16dp"
    android:paddingRight="16dp"
    android:orientation="vertical" >

    <EditText
        android:id="@+id/to"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" 
        android:hint="to"/>

    <EditText
        android:id="@+id/sub"
        android:layout_below="@id/to"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" 
        android:hint="subject"/>

    <EditText
        android:id="@+id/msg"
        android:layout_below="@id/sub"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" 
        android:hint="message"/>

    <Button
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:text="send"/>

</RelativeLayout>

在LinearLayout中,您将无法执行此操作。希望能帮助到你。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

如何在Android主屏幕ListView小部件中加载项目?

来自分类Dev

如何在Flutter中从类(小部件外部)打开屏幕

来自分类Dev

如何在主屏幕小部件中使用按钮(例如活动)

来自分类Dev

如何每天更新主屏幕小部件

来自分类Dev

如何在Android SDK模拟器主屏幕上添加应用小部件?

来自分类Dev

{{field}}如何在Django模板中显示field小部件?

来自分类Dev

如何在tkinter.Text小部件中显示行号?

来自分类Dev

如何在python中使用“按钮”小部件将按钮放置在屏幕上的特定位置?

来自分类Dev

如何在Wirecloud MapViewer小部件中显示实体

来自分类Dev

如何在MapViewer小部件中显示OrionContextBroker中的实体

来自分类Dev

如何从屏幕底部显示segue

来自分类Dev

如何在Tkinter中显示/隐藏小部件?

来自分类Dev

如何在自定义小部件中显示QChartView?

来自分类Dev

如何在“时钟”小部件中显示Google日历事件?

来自分类Dev

Flutter-如何在滚动到屏幕上时创建窗口小部件

来自分类Dev

如何在Android主屏幕小部件中保持套接字连接有效

来自分类Dev

如何在voila中的HTML小部件中显示图像

来自分类Dev

如何在Django中显示我的RadioSelect小部件

来自分类Dev

Flutter:-如何在屏幕上显示动态小部件?

来自分类Dev

如何在带有抖动的悬停上显示小部件?

来自分类Dev

如何在flutter中将小部件屏幕截图存储为jpg文件?

来自分类Dev

如何添加有状态的窗口小部件或在底部的另一个屏幕中查看

来自分类Dev

如何在小部件底部显示TabBar

来自分类Dev

在Flutter中,如何在较大的屏幕尺寸上修复PopupMenuItem窗口小部件中的截断文本?

来自分类Dev

如何在子小部件中禁用底部的SafeArea或更改其颜色?

来自分类Dev

如何每天更新主屏幕小部件

来自分类Dev

如何在小部件的TextView中显示当前时间

来自分类Dev

如何在时钟小部件中显示 Google 日历事件?

来自分类Dev

如何将列表视图中的数据显示到主屏幕小部件中?

Related 相关文章

  1. 1

    如何在Android主屏幕ListView小部件中加载项目?

  2. 2

    如何在Flutter中从类(小部件外部)打开屏幕

  3. 3

    如何在主屏幕小部件中使用按钮(例如活动)

  4. 4

    如何每天更新主屏幕小部件

  5. 5

    如何在Android SDK模拟器主屏幕上添加应用小部件?

  6. 6

    {{field}}如何在Django模板中显示field小部件?

  7. 7

    如何在tkinter.Text小部件中显示行号?

  8. 8

    如何在python中使用“按钮”小部件将按钮放置在屏幕上的特定位置?

  9. 9

    如何在Wirecloud MapViewer小部件中显示实体

  10. 10

    如何在MapViewer小部件中显示OrionContextBroker中的实体

  11. 11

    如何从屏幕底部显示segue

  12. 12

    如何在Tkinter中显示/隐藏小部件?

  13. 13

    如何在自定义小部件中显示QChartView?

  14. 14

    如何在“时钟”小部件中显示Google日历事件?

  15. 15

    Flutter-如何在滚动到屏幕上时创建窗口小部件

  16. 16

    如何在Android主屏幕小部件中保持套接字连接有效

  17. 17

    如何在voila中的HTML小部件中显示图像

  18. 18

    如何在Django中显示我的RadioSelect小部件

  19. 19

    Flutter:-如何在屏幕上显示动态小部件?

  20. 20

    如何在带有抖动的悬停上显示小部件?

  21. 21

    如何在flutter中将小部件屏幕截图存储为jpg文件?

  22. 22

    如何添加有状态的窗口小部件或在底部的另一个屏幕中查看

  23. 23

    如何在小部件底部显示TabBar

  24. 24

    在Flutter中,如何在较大的屏幕尺寸上修复PopupMenuItem窗口小部件中的截断文本?

  25. 25

    如何在子小部件中禁用底部的SafeArea或更改其颜色?

  26. 26

    如何每天更新主屏幕小部件

  27. 27

    如何在小部件的TextView中显示当前时间

  28. 28

    如何在时钟小部件中显示 Google 日历事件?

  29. 29

    如何将列表视图中的数据显示到主屏幕小部件中?

热门标签

归档