Android Studio App设置线性布局LinerLayout控件占屏幕长宽比例

如何设置两个控件在水平方向上的占屏幕的比例?

1.要有线性布局LinerLayout

2.设置线性布局控件水平排列:

android:orientation="horizontal"
3.设置第一个控件:

android:layout_width="0dp"
android:layout_weight="6"

第二个控件:

android:layout_width="0dp"
android:layout_weight="4"
这样两个控件占屏幕比例分别为6:4. 整个布局范例内容如下:


    
    
实际效果:

Android Studio App设置线性布局LinerLayout控件占屏幕长宽比例_第1张图片

你可能感兴趣的:(Android,App开发)