我正在制作一个应用程序,其中RelativeLayout
完全适合屏幕。我已经添加了一个按钮,使用setScaleX()
和setScaleY()
来缩放此布局。因此(显然)整个布局不再适合屏幕。所以我首先想到使用ScrollView
可以在RelativeLayout
中移动,但这不起作用。有什么建议么?提前致谢。在RelativeLayout中移动android
下面是XML代码:
<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:id="@+id/layoutMain"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="phou.minesweeper.GameActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/chronometer"
android:layout_below="@+id/textViewBest">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:layout_centerVertical="true">
<RelativeLayout
android:id="@+id/grid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:layout_centerVertical="true"></RelativeLayout>
</ScrollView>
</RelativeLayout>
</RelativeLayout>
其中即时缩放RelativeLayout
是具有ID =网格。 xml代码太短了,因为所有视图都是用java创建的。
向我展示你的xml代码。 –