ScrollView 在 android 工作室工作,但不在我的智能手机上工作
ScrollView is working in android studio but not on my smartphone
我不知道为什么它在 IDE 中工作,但是当我在我的设备上安装 apk 时。 (我在 RelativeLayout 中有一张 4000x1080 像素的背景图片)。
android:id="@+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#f7f7f7"
android:fillViewport="true"
android:orientation="vertical">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@mipmap/space1"
android:fillViewport="true"
android:padding="0dp">
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="56dp"
android:text="Hello World !"
android:textColor="#FFFFFF"/>
<ImageButton
android:id="@+id/imageButton"
android:layout_width="55dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:adjustViewBounds="true"
android:background="@null"
android:padding="5dp"
android:scaleType="centerInside"
app:srcCompat="@drawable/level1"
android:gravity="center"
android:layout_marginLeft="455px"
android:layout_marginTop="1300px"/>
</RelativeLayout>
预先感谢您的帮助。
尝试将大图像放在 RelativeLayout 内的 ImageView 中,而不是作为背景...最好使用 dp 尺寸单位而不是 px
只需在 ScrollView 中添加并从 RelativeLayout 中删除
<...
android:fillViewport="true"
.../>
我不知道为什么它在 IDE 中工作,但是当我在我的设备上安装 apk 时。 (我在 RelativeLayout 中有一张 4000x1080 像素的背景图片)。
android:id="@+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#f7f7f7"
android:fillViewport="true"
android:orientation="vertical">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@mipmap/space1"
android:fillViewport="true"
android:padding="0dp">
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="56dp"
android:text="Hello World !"
android:textColor="#FFFFFF"/>
<ImageButton
android:id="@+id/imageButton"
android:layout_width="55dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:adjustViewBounds="true"
android:background="@null"
android:padding="5dp"
android:scaleType="centerInside"
app:srcCompat="@drawable/level1"
android:gravity="center"
android:layout_marginLeft="455px"
android:layout_marginTop="1300px"/>
</RelativeLayout>
预先感谢您的帮助。
尝试将大图像放在 RelativeLayout 内的 ImageView 中,而不是作为背景...最好使用 dp 尺寸单位而不是 px
只需在 ScrollView 中添加并从 RelativeLayout 中删除
<...
android:fillViewport="true"
.../>