java Android:用于存储自定义设计控件的选择器 (xml) 文件的位置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12709480/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android: Where to store Selector (xml) file for customed design controls
提问by Raf
I tried to make a custom LinearLayout and Button styles.
我尝试制作自定义的 LinearLayout 和 Button 样式。
I'm just wondering where to place my Selector xml files?
我只是想知道在哪里放置我的 Selector xml 文件?
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient
android:angle="90"
android:startColor="#534E4E"
android:endColor="#000000"
android:type="linear" />
</shape>
</item>
In my mono project I put the files at drawable folder BUT in my Java(native) development I don't know maybe I miss the basic in storing files but still have no Idea where to put my Selector since the latest Eclipse plugin has 4 drawables (-ldpi,-hdpi, mdpi and xhdpi).
在我的单声道项目中,我将文件放在可绘制文件夹中,但在我的 Java(本机)开发中我不知道也许我错过了存储文件的基本知识,但仍然不知道将我的选择器放在哪里,因为最新的 Eclipse 插件有 4 个可绘制对象(-ldpi、-hdpi、mdpi 和 xhdpi)。
回答by Rajeev N B
Create a drawable/ folder in the res/ directory and add the selector.xml files in there.
在 res/ 目录中创建一个 drawable/ 文件夹并在其中添加 selector.xml 文件。
回答by vrinda
Place it in all the drawable folders so that the image adjust in different size phones. That worked for me.
将其放在所有可绘制文件夹中,以便图像在不同尺寸的手机中进行调整。那对我有用。