【发布时间】:2020-09-10 10:40:48
【问题描述】:
有人可以建议我设计 android 布局以支持移动设备和平板电脑的最佳方法。 附上 3 种不同设备的屏幕截图(2 台平板电脑和 1 台手机)
我使用 layout-sw600dp 来支持 al 平板电脑。我希望这下的所有布局都能加载到最小宽度为 600dp(即最小边)的平板电脑上
问题:这是为移动设备和平板电脑分开布局的正确方法吗?
我遇到的一个问题是矢量 xml 文件在涉及到平板电脑时会被拉伸(我在下面附上了矢量 xml 代码)
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="360dp"
android:height="640dp"
android:viewportWidth="360"
android:viewportHeight="640">
<path
android:pathData="M0,0h360v640h-360z"
android:fillColor="#fff"/>
<path
android:pathData="M0.001,0h360v10.634l-360,207.846Z">
<aapt:attr name="android:fillColor">
<gradient
android:startY="6.1174397"
android:startX="309.601"
android:endY="58.989597"
android:endX="-134.99901"
android:type="linear">
<item android:offset="0" android:color="#FFFFB88C"/>
<item android:offset="1" android:color="#FFDE6262"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M70.674,0L360,0L360,501.127Z">
<aapt:attr name="android:fillColor">
<gradient
android:startY="-30.568748"
android:startX="197.39879"
android:endY="501.127"
android:endX="387.7753"
android:type="linear">
<item android:offset="0" android:color="#FFDE6262"/>
<item android:offset="1" android:color="#FFFFB88C"/>
</gradient>
</aapt:attr>
</path>
添加 svg 图像的矢量 xml 文件的正确方法是什么。我需要这个 xml 文件的多个版本吗(如果需要,匹配不同屏幕大小的命名约定是什么) 我想我以前做过这个但会导致重复的 xml 错误(即当我将它添加到 drawable-ldpi、xhdpi 等时)
有人可以建议我在上述情况下为 android 布局提供最佳解决方案
提前致谢
【问题讨论】:
标签: android xml android-layout svg layout