简体   繁体   English

Android-如何创建不同状态(默认,已按下和已聚焦)的图像按钮

[英]Android - How to create image button of different states, default , pressed and focussed

In my android application i want to create three different image of a single image for each state pressed , default and focussed. 在我的android应用程序中,我想为每种状态(按,默认和聚焦)创建单个图像的三个不同图像。 Is there any tool that can help me to create these images. 有没有什么工具可以帮助我创建这些图像。

I think you misunderstood my problem, i knows that how to use three different image for three different states. 我认为您误解了我的问题,我知道如何为三种不同的状态使用三种不同的图像。 I only wants to know that how two create those three images. 我只想知道两个如何创建这三个图像。

here http://code.google.com/p/iosched/source/browse/android/#android%2Fres%2Fdrawable-hdpi you can see that there are three different images for three differenct states http://code.google.com/p/iosched/source/browse/android/#android%2Fres%2Fdrawable-hdpi中,您可以看到针对三种不同状态存在三种不同的图像

  1. home_btn_announcements_default.png home_btn_announcements_default.png
  2. home_btn_announcements_pressed.png home_btn_announcements_pressed.png
  3. home_btn_announcements_selected.png home_btn_announcements_selected.png

I wants to know that is there any tool that can create the above three images. 我想知道有没有可以创建上述三个图像的工具。 I think now my question is clear to everyone. 我想我的问题现在对每个人都清楚。

My Question was that how to add white border for default image , gray border for focussed image. 我的问题是,如何为默认图像添加白色边框,为聚焦图像添加灰色边框。 I know that how to change image according to different states. 我知道如何根据不同的状态更改图像。 I want to ask you that is there any tool that can put white or gray border around my image. 我想问你,是否有任何工具可以在我的图像周围放置白色或灰色边框。

Use selector save this file in drawable/click.xml 使用选择器将此文件保存在drawable / click.xml中

     <?xml version="1.0" encoding="utf-8"?>
       <selector xmlns:android="http://schemas.android.com/apk/res/android" >
     <item android:state_pressed="false" android:drawable="@drawable/notPressedImage ></item>
     <item android:state_pressed="true" android:drawable="@drawable/PressedImage" ></item>

     </selector>

use click.xml (click) as button src... 使用click.xml(click)作为按钮src ...

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

相关问题 Android的三个按钮状态(已按下,未按下和默认) - Android three button states (pressed, not pressed and default) Android如何在按下或聚焦时使按钮文本加粗 - Android how to make button text bold when pressed or focussed 如何在Android中修改默认按钮状态而不影响按下状态和选定状态? - How to modify the default button state in Android without affecting the pressed and selected states? Android如何在按下或聚焦时使TextView文本变为粗体 - Android how to make TextView text bold when pressed or focussed 要聚焦的按钮和默认选择的条件 - Button to be focussed & in default selected condition 只要按下按钮,如何更改图像…然后在按钮上显示默认值就不要按下android - how to change image as long as button is pressed… and then showing default on button unpress android 如何将按钮背景更改为图像,然后在按下时恢复为默认按钮 - How to change a button background to image then back to default button when pressed Android图像按钮有三种状态? - Android Image button with three states? 如何在具有@drawable图像的选定和按下状态下为按钮设置背景色 - How to set background colour for a button in selected and pressed states that has @drawable image Android - 如何将按钮的形状drwable和文本颜色组合为不同的状态? - Android - How combining Shape drwable and text color different states for button?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM