我的申请有问题.我最近添加了ScrollView作为LinearLayout的Parent.将设备方向翻转为横向时,我的按钮会在顶部被切断.当我向下滚动时,我可以看到最后一个按钮就好了,在它的末尾有额外的"黑色空间",只有顶部被切掉了.我环顾四周,我不确定为什么会这样.这是一些图片,所以你可以理解它的外观.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:gravity="center_vertical">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center">
<Button
android:id="@+id/BeefButton"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_gravity="center"
android:background="@drawable/backgroundlayer"
android:drawableLeft="@drawable/beefbutton"
android:text="Beef"
android:textColor="#FFFFFF"
android:textSize="32px"
android:textColorHighlight="#FF6600"/>
<Button
android:id="@+id/PoultryButton"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_width="match_parent"
android:background="@drawable/backgroundlayer"
android:drawableLeft="@drawable/chickenbutton"
android:text="Poultry"
android:textColor="#FFFFFF"
android:textSize="32px"
android:textColorHighlight="#FF6600"/>
<Button
android:id="@+id/FishButton"
android:layout_height="wrap_content"
android:background="@drawable/backgroundlayer"
android:drawableLeft="@drawable/fishbutton"
android:text="Fish"
android:textColor="#FFFFFF"
android:textSize="32px"
android:textColorHighlight="#FF6600"
android:layout_gravity="center"
android:layout_width="match_parent"/>
<Button
android:id="@+id/PorkButton"
android:layout_height="wrap_content"
android:background="@drawable/backgroundlayer"
android:drawableLeft="@drawable/porkbutton"
android:text="Pork"
android:textColor="#FFFFFF"
android:textSize="32px"
android:textColorHighlight="#FF6600"
android:layout_gravity="center"
android:layout_width="match_parent"/>
<Button
android:id="@+id/VegetablesButton"
android:layout_height="wrap_content"
android:background="@drawable/backgroundlayer"
android:drawableLeft="@drawable/vegetablesbutton"
android:text="Vegetables"
android:textColor="#FFFFFF"
android:textSize="32px"
android:textColorHighlight="#FF6600"
android:layout_gravity="center"
android:layout_width="match_parent"/>
</LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)