Shr*_*jan 4 android android-widget android-emulator android-layout
我的应用程序有一些布局问题.这是我的应用程序布局:
<?xml version="1.0" encoding="utf-8"?>
Run Code Online (Sandbox Code Playgroud)
<ImageView android:layout_width="fill_parent" android:layout_height="wrap_content"
android:src="@drawable/tax_calculator_logo"/>
<LinearLayout android:layout_height="fill_parent" android:layout_width="fill_parent"
android:orientation="vertical" android:layout_marginLeft="20dp"
android:layout_marginRight="20dp" android:layout_gravity="center"
android:layout_marginTop="10dp" android:layout_marginBottom="10dp">
<Button android:id="@+id/contactUs" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:text="Contact Us"
android:textSize="20dp"/>
<Button android:id="@+id/contactUs" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:text="Contact Us"
android:textSize="20dp"/>
<Button android:id="@+id/contactUs" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:text="Contact Us"
android:textSize="20dp"/>
<Button android:id="@+id/contactUs" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:text="Contact Us"
android:textSize="20dp"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
在这里,我想将此全部按钮设置为完全适合任何设备的屏幕高度.是的,我可以显示所有按钮.但我希望他们都能在他们之间拥有平等的空间,他们必须完全符合屏幕高度.那我该怎么办?
编辑:
还有,我的tax_calculator_logo分辨率为600x239,我将ImageView高度设置为wrap_content,宽度设置为fill_parent,然后为什么Image从底部和顶部裁剪?
Yas*_*mar 13
为每个按钮赋予相同的重量,它们将自动共享高度.
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
android:orientation="vertical" >
<Button
android:id="@+id/contactUs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Contact Us"
android:textSize="20dp" />
<Button
android:id="@+id/contactUs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Contact Us"
android:textSize="20dp" />
<Button
android:id="@+id/contactUs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Contact Us"
android:textSize="20dp" />
<Button
android:id="@+id/contactUs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Contact Us"
android:textSize="20dp" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16139 次 |
| 最近记录: |