Java 当设备方向更改为水平时,LinearLayout按钮不出现?
这是一个xml,其中ScrollView布局大小将发生变化,这意味着它将在单击按钮时缩放图像,但无论缩放值如何,我的顶部页眉和页脚始终处于相同的位置 XMLJava 当设备方向更改为水平时,LinearLayout按钮不出现?,java,android,xml,Java,Android,Xml,这是一个xml,其中ScrollView布局大小将发生变化,这意味着它将在单击按钮时缩放图像,但无论缩放值如何,我的顶部页眉和页脚始终处于相同的位置 XML <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" androi
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/layout_zoom_buttons"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/btn_zoomIn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/zoomin1" />
<ImageView
android:id="@+id/btn_zoomout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/zoomin1" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<com.example.imagetouchview.TouchImageView
android:id="@+id/imagezoom"
android:layout_width="fill_parent"
android:layout_height="400dp"
android:layout_gravity="center">
</com.example.imagetouchview.TouchImageView>
</ScrollView>
<LinearLayout
android:id="@+id/layout_buttons"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="@+id/btn_email_fatwa"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/zoomin1"
android:layout_weight="1"/>
<ImageView
android:id="@+id/btn_share_fatwa"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/zoomin1"
android:layout_weight="1"/>
<ImageView
android:id="@+id/btn_save_fatwa"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/zoomin1"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>
此布局在垂直方向上很好,而当设备方向更改为水平方向时,底部按钮不可见。我遵循我认为您已经在纵向模式(垂直)下设计了布局。现在要么你得把它绑起来 肖像模式,在活动清单中添加以下行android:screenOrientation=“肖像” 或 您必须按照此链接为横向模式进行设计-
我需要两个方向,你可以编辑我的代码以在两个方向上工作吗?你必须在两个方向上设计它,因为我给出了链接,请遵循这一点。如果获得解决方案,请接受ans创建一个新的文件夹布局,在Resources文件夹中,将您的.xml复制到其中并在视图中进行设计。在设备方向上,它将自动加载水平xml,或者可能需要明确定义它将在您面对时自动使用的设备。