【问题标题】:Text padding (Gridview) - Material design guidelines文本填充 (Gridview) - 材料设计指南
【发布时间】:2015-02-08 19:48:32
【问题描述】:

好的,所以我正在尝试用单行文本制作图像网格(材料设计指南)。单行指南:

单行页眉/页脚

高度: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 gridview material-design


【解决方案1】:

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

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-08-02
    • 2022-12-20
    • 2014-12-08
    • 1970-01-01
    • 2015-01-04
    • 2017-06-18
    • 1970-01-01
    • 2015-02-17
    相关资源
    最近更新 更多