我有一个布局问题,无法在高分辨率(如1920x1080)下拉伸。 作为根布局,我使用以下样式的约束布局:
<android.support.constraint.ConstraintLayout 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="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"
tools:context="njc.nhutrinhgold.MainActivity">
<ImageView
android:id="@+id/imgNen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:visibility="visible"
app:layout_constraintDimensionRatio="16:9"
app:srcCompat="@drawable/xxhdpibg"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp"
tools:layout_width="match_parent" />
在 Manifest.xml 文件中
<supports-screens
android:anyDensity="true"
android:compatibleWidthLimitDp="960"
android:largeScreens="true"
android:largestWidthLimitDp="960"
android:normalScreens="false"
android:requiresSmallestWidthDp="960"
android:resizeable="false"
android:smallScreens="false"
android:xlargeScreens="true" />
我想将布局延伸到任何屏幕分辨率,但在高分辨率的模拟器上,它看起来像这样:实际上我还没弄清楚问题出在哪里。