设计 Android 个小部件的宽度和高度

Designing widths and heights of Android widgets

设计小部件的宽度和高度以使其在纵向和横向模式下看起来都不错的最佳方法是什么?例如,我正在尝试制作一个简单的注册页面,当他们输入信息并且格式正确时,我想在相应的 EditText 视图旁边显示一个小复选框图像。

我的特殊问题是,如果没有图像复选框,我只需将 EditText 宽度设置为 match_parent,它就会在纵向和横向模式下扩展到整个屏幕。但是一旦我在 EditText 小部件旁边添加 ImageView 复选框,我必须将 EditText 的宽度设置为特定的 dp 值,以便为要显示的复选框留出空间。但是现在它有一个特定的 dp 值,当我将屏幕旋转到横向模式时,EditText 视图的宽度比我想要的要短得多。

所以我的问题是,设计小部件的高度和宽度的最佳方式是什么,以便它们在几乎所有手机上看起来都不错,并且在纵向和横向模式下看起来都不错?我是应该一直为横向模式设计一个单独的布局,还是有更聪明的方法来避免这种情况?

<LinearLayout 
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

<EditText 
    android:layout_width="match_parent"
    android:layout_height="30dp"
    android:layout_weight="2"
     <!-- your stuff here --> />
<ImageView
    android:layout_width="match_parent"
    android:layout_height="30dp"
    android:layout_weight="0.5"
    <!-- your stuff here --> />
 />