Android 在线性布局中使用权重时,如何保持纵横比?
我有一个垂直线性布局,包含两个ImageView和两个按钮。ImageView的权重和为70,按钮的权重和为30。这两个按钮具有指定的纵横比,当Android使用指定的重量调整它们的大小时,它只会通过更改纵横比来更改按钮的高度。使用以下方法解决:Android 在线性布局中使用权重时,如何保持纵横比?,android,Android,我有一个垂直线性布局,包含两个ImageView和两个按钮。ImageView的权重和为70,按钮的权重和为30。这两个按钮具有指定的纵横比,当Android使用指定的重量调整它们的大小时,它只会通过更改纵横比来更改按钮的高度。使用以下方法解决: ImageButton而不是Button android:src而不是android:background android:background=“#00000000” android:scaleType=“fitCenter” android:la
- ImageButton而不是Button
- android:src而不是android:background
- android:background=“#00000000”
- android:scaleType=“fitCenter”
- android:layout\u width=“匹配父项”
- android:adjustViewBounds=“true”