Android:适合三个大的图像视图

Android:适合三个大的图像视图,android,xml,imageview,Android,Xml,Imageview,我有一个imageview,它显示的图像覆盖了大约一半的屏幕。这是一节课: public class DialButton2 extends ImageView{ public DialButton2(Context context) { super(context); this.setImageResource(R.drawable.dialpad); } public DialButton2(Context context, Att

我有一个imageview,它显示的图像覆盖了大约一半的屏幕。这是一节课:

public class DialButton2 extends ImageView{

    public DialButton2(Context context) {
        super(context);
        this.setImageResource(R.drawable.dialpad);
    }

    public DialButton2(Context context, AttributeSet attrs){
        super(context, attrs);
        this.setImageResource(R.drawable.dialpad);
    }

}
我的问题是如何在屏幕上安装其中三个。如果我在使用xml时添加其中一个,我可以使用wrap_内容,它将包装内容,我可以使用fill_parent,它将放大并填充parent,但是如果我需要在一行中放入三个,我应该如何强制xml将它们放大并作为三个一组放入?我当前的代码不起作用,它将两个放在一行中,而将第三个放在一行中(因为它占用了屏幕外的空间):


在将布局宽度设置为0px时,可以使用(所有3个子视图的布局宽度相等)。这将使它们各自采取成比例的措施来组合以填充可用空间。

在将布局宽度设置为0px时,您可以使用(所有3个子视图的宽度相等)。这将使它们各自采取相应的措施来组合,以填充可用空间。


<com.com.com.DialButton2
android:id="@+id/button3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitCenter"
android:layout_weight="1"
/>
对所有3个视图使用此选项



对所有3个视图使用此选项

这是否会使它们在任何屏幕大小/手机上缩放为三个连续视图?这是最好的做法吗?谢谢,但这似乎不起作用。还有其他想法或提示吗?是的,这是说“我希望这个线性布局中的每个视图占据整个布局的这个比例”的标准方式。到底什么不起作用?您是否尝试过使用(非自定义)视图(例如,文本视图)?是否将每个子视图的布局宽度设置为0px,并将每个布局权重设置为1?您可能还想使用
adjustViewBounds
属性。这会使它们在任何屏幕大小/手机上缩放到三个一行吗?这是最好的做法吗?谢谢,但这似乎不起作用。还有其他想法或提示吗?是的,这是说“我希望这个线性布局中的每个视图占据整个布局的这个比例”的标准方式。到底什么不起作用?您是否尝试过使用(非自定义)视图(例如,文本视图)?是否将每个子视图的布局宽度设置为0px,并将每个布局权重设置为1?您还可能需要使用
adjustViewBounds
属性。
<com.com.com.DialButton2
android:id="@+id/button3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitCenter"
android:layout_weight="1"
/>