我的问题是,所有这些视图有不同的左边距,当我把它们放在另一个下面时,它看起来很混乱。对齐材质edittexts,textviews,复选框等
我该如何解决?有没有很酷的方法来解决这个问题?
我试图把一些额外的填充,如2dp为edittexts和4dp为textviews,但它似乎不工作,因为不同的设备上填充不同。
示例(在Google官方应用中并非如此): 这里没有什么特别的布局,只是没有任何附加属性的视图。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="0dip">
<EditText
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/network_password"
android:inputType="textPassword"/>
</android.support.design.widget.TextInputLayout>
<CheckBox
android:id="@+id/checkbox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/show_password"/>
</LinearLayout>
请分享您的布局。 –