我想指定使用变量的drawablein 的宽度/高度dp
喜欢:
<dp name="width">30</dp>
使用时width:
android:layout_width=width 就像说 android:layout_width="30dp"
有什么办法吗?
如下所示创建您的dp价值dimens.xml:
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="width">16dp</dimen>
</resources>
Run Code Online (Sandbox Code Playgroud)
并使用
<ImageView
android:layout_width="@dimen/width"
android:layout_height="match_parent" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
109 次 |
| 最近记录: |