我有创造与对齐到文本的开始按钮CardView一个问题:CardView按钮和文本对齐不
我下面列出的材料尺寸设计填充和文本大小的规范。这是我正在使用的XML:
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="24dp"
android:text="Title goes here"
android:textColor="@color/primary_text_default_material_light"
android:textSize="24sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:text="Subtitle here"
android:textSize="14sp" />
<Button
style="@style/Base.Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:padding="0dp"
android:text="Action 1"
android:textColor="@color/accent_material_light" />
</LinearLayout>
</android.support.v7.widget.CardView>
从视觉上看,文本的开始与无边界按钮文本之间存在差距。
正如Material Design spec所示,按钮,标题和副标题开始就要排队:
我要去哪里错了?
我只是尝试这样做,我注意到,如果按钮上的文字很短的长度,则填充变成两边不平衡,导致在没有垂直对齐关键线这 – user2560886