超出屏幕的按钮 - Android

马库斯怀特

我需要帮助...

我试图buttons在 a 内部构建 3 个对齐的 1 行和 3 列GridLayout,看起来它可以工作,但我认为我没有做到这一点,因为如果更改按钮 ( textSize)内文本的大小,GridLayout和按钮正在走出屏幕。我认为我设置layout_witdh和/或layout_height错误,但我不确定。

谁能帮我?谢谢 :)

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:background="@drawable/background"
    tools:context="com.markus.tssproject.MainActivity">

    <RelativeLayout
        android:layout_weight="2"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <GridLayout
            android:layout_width="match_parent"
            android:layout_height="110dp"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_marginBottom="5dp"
            android:layout_marginRight="5dp"
            android:layout_marginLeft="5dp"
            android:columnCount="3"
            android:rowCount="1">

            <Button
                android:id="@+id/id0"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_column="0"
                android:layout_columnWeight="1"
                android:layout_gravity="fill"
                android:layout_marginRight="3dp"
                android:layout_row="0"
                android:layout_rowWeight="1"
                android:padding="30dp"
                android:tag="0"
                android:text="test tested testing"
                android:textSize="20sp" />

            <Button
                android:id="@+id/open1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="3dp"
                android:layout_column="1"
                android:layout_columnWeight="1"
                android:layout_gravity="fill"
                android:layout_row="0"
                android:layout_rowWeight="1"
                android:padding="30dp"
                android:tag="1"
                android:text="test tested testing"
                android:texSize="20sp" />

            <Button
                android:id="@+id/open2"
                android:layout_width="wrap_content"
                android:layout_column="2"
                android:layout_height="wrap_content"
                android:layout_columnWeight="1"
                android:layout_gravity="fill"
                android:layout_row="0"
                android:layout_rowWeight="1"
                android:padding="30dp"
                android:tag="2"
                android:text="teste tested testing"/>

        </GridLayout>
    </RelativeLayout>
</LinearLayout>
阿香塔

在每个按钮中更改以下内容

android:layout_width="0dip"
android:layout_weight ="1"

你可以自己做这个LinearLayout,不需要网格布局

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

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

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

android表布局超出屏幕

来自分类Dev

Android:创建超出屏幕宽度的布局

来自分类Dev

Android模拟器窗口顶部栏超出屏幕

来自分类Dev

Cordova / Ionic框架(Android)-启动屏幕超出比例

来自分类Dev

Android-单击按钮进入新屏幕

来自分类Dev

Android:在屏幕点击时禁用按钮

来自分类Dev

Android Studio屏幕捕获按钮为灰色

来自分类Dev

Android菜单布局,以使屏幕充满按钮

来自分类Dev

android按钮在较小的屏幕设备中缩小

来自分类Dev

Android按钮未拉伸到屏幕宽度

来自分类Dev

Android Studio !!不同屏幕尺寸的按钮

来自分类Dev

Android:在屏幕点击时禁用按钮

来自分类Dev

在不同屏幕尺寸的Android上调整按钮的大小

来自分类Dev

Android:如何更改将屏幕分成3个相等的按钮

来自分类Dev

Android:单击按钮后从屏幕底部显示布局

来自分类Dev

如何在Android中对齐屏幕中心的按钮

来自分类Dev

Android:将几个按钮缩放到屏幕尺寸

来自分类Dev

Card.io扫描屏幕Android中的“取消”按钮

来自分类Dev

在Android上将按钮移至屏幕时如何返回以前的活动?

来自分类Dev

Android - 如何使屏幕叠加层上的按钮可点击

来自分类Dev

如何在Android中区分屏幕锁定和按下主屏幕按钮?

来自分类Dev

如何在Android中启动屏幕后隐藏主屏幕上的后退按钮?

来自分类Dev

Android-如何根据屏幕大小和彼此下方的按钮以编程方式添加按钮?

来自分类Dev

在按下Android设备主屏幕按钮后,启动活动所需的意图标志的Android

来自分类Dev

画布视图超出屏幕

来自分类Dev

画布视图超出屏幕

来自分类Dev

Android中的“添加到主屏幕”按钮未将网站显示为Web App

来自分类Dev

Android在相对布局中使按钮为屏幕宽度和高度的1/3

来自分类Dev

Android-将我应用的按钮添加到锁定屏幕?

Related 相关文章

  1. 1

    android表布局超出屏幕

  2. 2

    Android:创建超出屏幕宽度的布局

  3. 3

    Android模拟器窗口顶部栏超出屏幕

  4. 4

    Cordova / Ionic框架(Android)-启动屏幕超出比例

  5. 5

    Android-单击按钮进入新屏幕

  6. 6

    Android:在屏幕点击时禁用按钮

  7. 7

    Android Studio屏幕捕获按钮为灰色

  8. 8

    Android菜单布局,以使屏幕充满按钮

  9. 9

    android按钮在较小的屏幕设备中缩小

  10. 10

    Android按钮未拉伸到屏幕宽度

  11. 11

    Android Studio !!不同屏幕尺寸的按钮

  12. 12

    Android:在屏幕点击时禁用按钮

  13. 13

    在不同屏幕尺寸的Android上调整按钮的大小

  14. 14

    Android:如何更改将屏幕分成3个相等的按钮

  15. 15

    Android:单击按钮后从屏幕底部显示布局

  16. 16

    如何在Android中对齐屏幕中心的按钮

  17. 17

    Android:将几个按钮缩放到屏幕尺寸

  18. 18

    Card.io扫描屏幕Android中的“取消”按钮

  19. 19

    在Android上将按钮移至屏幕时如何返回以前的活动?

  20. 20

    Android - 如何使屏幕叠加层上的按钮可点击

  21. 21

    如何在Android中区分屏幕锁定和按下主屏幕按钮?

  22. 22

    如何在Android中启动屏幕后隐藏主屏幕上的后退按钮?

  23. 23

    Android-如何根据屏幕大小和彼此下方的按钮以编程方式添加按钮?

  24. 24

    在按下Android设备主屏幕按钮后,启动活动所需的意图标志的Android

  25. 25

    画布视图超出屏幕

  26. 26

    画布视图超出屏幕

  27. 27

    Android中的“添加到主屏幕”按钮未将网站显示为Web App

  28. 28

    Android在相对布局中使按钮为屏幕宽度和高度的1/3

  29. 29

    Android-将我应用的按钮添加到锁定屏幕?

热门标签

归档