简体   繁体   English

如何设置可绘制对象的大小?

[英]How to set the size of a drawable?

The android developer docs say that the size for an icon in the action bar should be 32x32 dp . android开发人员文档说,操作栏中图标的大小应为32x32 dp I have an xml as follows: 我有一个XML,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/new_game"
          android:icon="@drawable/my_pic1"
          android:title="@string/new_game"
          android:showAsAction="ifRoom"/>
</menu>

How can I make the size of my_pic1 32x32dp? 如何使my_pic1的大小为32x32dp?

you don't need to specify explicit size here, you just need to put correct drawable image in correct folder. 您无需在此处指定明确的尺寸,只需在正确的文件夹中放置正确的可绘制图像即可。 You can download launcher icons from Here and put drawables according to their resolution in respective folders. 您可以从此处下载启动器图标,并根据其分辨率将可绘制对象放入相应的文件夹中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM