我有 5 个宽度限定符最小的 dimens 文件夹。
sw240dp
<dimen name="album_size">200.1dp</dimen>
sw320dp
<dimen name="album_size">266.7dp</dimen>
sw480dp
<dimen name="album_size">400dp</dimen>
sw600dp(适用于平板电脑)
<dimen name="album_size">501dp</dimen>
我在 android 文档中找到的关于屏幕支持的内容
320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).
480dp: a large phone screen ~5" (480x800 mdpi).
600dp: a 7” tablet (600x1024 mdpi).
从 3.7 英寸到 6.0 的所有模拟器仅在 sw320dp 中显示我的 dimens.xml 文件中的值。
我想在不同的屏幕尺寸上支持我的布局文件
<android.support.constraint.ConstraintLayout
android:id="@+id/mSongAlbumCons"
android:layout_width="@dimen/album_size"
android:layout_height="@dimen/album_size"
app:layout_constraintBottom_toTopOf="@id/playerControls"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/mBottomSheet">
<ImageView
android:id="@+id/mAlbumArt"
android:layout_width="@dimen/album_size"
android:layout_height="@dimen/album_size"
android:scaleType="fitXY"
android:src="@drawable/image2" />
</android.support.constraint.ConstraintLayout>
是的,我的问题是专辑封面的宽度和高度在 3.7 英寸屏幕和 6.0 英寸屏幕上是一样的。
android 只显示 sw320dp 文件夹中的值的原因是什么?
谢谢,
编辑
对于 sw600dp,它工作得很好,仅对于 3.7 - 6.0 设备它不起作用。
最佳答案
请使用这个gradle。所有设备都支持它
implementation 'com.intuit.sdp:sdp-android:1.0.6'
使用方法:
android:textSize="@dimen/_16sdp"
关于java - 模拟器 View 只显示来自 sw320dp 的值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53661439/