繁体   English   中英

文本填充(Gridview)-材质设计准则

[英]Text padding (Gridview) - Material design guidelines

Okey,所以我正在尝试用一行文字来制作图像网格(材料设计准则)。 单行准则:

单行页眉/页脚

高度:48dp

文字内边距:16dp

默认字体大小:16sp

我这样做的方式使文本被截断,鉴于文本为16且合并的填充为32,这是有意义的:

格

我使用的是android:padding = 16dp,但我可能误解了指导原则。 有人可以帮助澄清。 提前致谢。

编辑:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.project.SquareImageView
    android:id="@+id/image"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scaleType="centerCrop" />

<TextView
    android:id="@+id/text"
    android:layout_width="match_parent"
    android:layout_height="48dp"
    android:layout_gravity="bottom"
    android:background="#40000000"
    android:padding="16dp"
    android:textColor="@android:color/white"
    android:textSize="16sp" />
</FrameLayout>

文本被裁剪,因为没有足够的空间,因为填充使实际视图变小。

我最终只设置了顶部和左侧的填充,这意味着没有底部的填充 那解决了我的问题。

android:paddingLeft="16dp"
android:paddingTop="16dp"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM