Okey, so i'm trying to make a grid of images with a single line of text (material design guidelines). Guidelines for single line:
Single-line header/footer
Height: 48dp
Text padding: 16dp
Default font size: 16sp
The way i did this it makes the text cut off, which kind of makes sense given the text of 16 and the combined padding being 32:
I used android:padding = 16dp, but i might have misunderstood the guidelines. Could someone help clarify. Thanks in advance.
Edit:
<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>
The text is cropped, because there is not enough space for it, because padding is making the actual view smaller.
I end up setting just top and left padding, which means, there is no bottom padding . That solved my issue.
android:paddingLeft="16dp"
android:paddingTop="16dp"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.