簡體   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