我正在尝试为我的应用程序imageview height's
和imageview width's
提供不同的XML值。问题是我需要智能手机版本和平板电脑版本的高度和宽度的不同值。有没有办法做到这一点?提前谢谢。
您可以在 Android 中使用资源限定符 查看此处
在尺寸文件中定义图像宽度和高度
值/二元.xml
<resources>
<dimen name="image_width">100dp</dimen>
</resources>
值-SW600DP/DIMENS.xml
<resources>
<dimen name="image_width">150dp</dimen>
</resources>
在活动/片段 xml 中
<ImageView
android:width="@dimen/image_width"
android:height="@dimen/image_height" />