【发布时间】:2023-03-18 18:52:01
【问题描述】:
我在更改屏幕方向时遇到问题。当手机处于纵向模式时,一切正常,但是当我将方向更改为横向模式时,imageview 隐藏了下面的按钮。
这是我的布局 xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"
android:longClickable="false">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Your Inbox"
android:id="@+id/btn_inbox"
android:layout_centerHorizontal="true" />
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:layout_below="@+id/btn_inbox"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:src="@drawable/img_main" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Scan QR"
android:id="@+id/btn_qrscan"
android:layout_below="@+id/imageView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:enabled="false" />
【问题讨论】:
-
android:configChanges="orientation|screenSize" 在您的活动场所的 manifest.xml 中使用这一行。它解决了我的问题
标签: android imageview landscape