【问题标题】:Third line clipping with padding in material designs Three-Line list在材料设计中使用填充进行第三行剪辑 三行列表
【发布时间】:2018-09-08 10:53:06
【问题描述】:

我正在开发一个适用于 android 的 java 应用程序,我在三行列表中显示一些信息。

Material designs guidelines for three-line lists: 主要文本字体:Roboto Regular 16sp

辅助文字字体:Roboto Regular 14sp

平铺高度:88dp

文本内边距,左:16dp

文本内边距,顶部:16dp

文本内边距,底部:20dp

我遇到的问题是第三行剪辑成两半,因为底部填充。我确定我做错了什么,但我不知道是什么。

这是列表项的 xml 文件:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="88dp"
    android:paddingTop="16dp"
    android:paddingBottom="20dp"
    android:orientation="vertical">

    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
        style="@style/listStyle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="@android:color/black"
        android:textSize="16sp"
        android:text="Test" />

    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
        style="@style/listStyle"
        android:text="Test"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="14sp" />

    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
        style="@style/listStyle"
        android:text="Test"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:textSize="14sp"/>
</LinearLayout>

风格:

<style name="listStyle">
        <item name="android:paddingLeft">16dp</item>
        <item name="android:paddingRight">16dp</item>
        <item name="android:fontFamily">Roboto Regular</item>
</style>

列表视图:

<ListView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingTop="8dp"
        android:paddingBottom="8dp"
/>

How the list looks

【问题讨论】:

    标签: android xml material-design


    【解决方案1】:

    改变你的 LinearLayout

    android:layout_height="88dp"
    

    android:layout_height="wrap_content"
    

    【讨论】:

    • 是的,这可以解决问题,但是 Material Design 指南说瓷砖高度应该是 88dp。我想我只是对为什么他们自己的指导方针不起作用感到困惑。
    猜你喜欢
    • 1970-01-01
    • 2021-10-01
    • 1970-01-01
    • 2023-04-07
    • 2018-11-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-20
    相关资源
    最近更新 更多