android - Holo theme and custom background for my button -


i have problems add blue color on button when user press it. works if there no drawable in background button in case, have add custom background , want blue color when user clicks on button. here code

<button     android:id="@+id/create_profile"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_below="@+id/info_account"     android:layout_centerhorizontal="true"     android:background="@drawable/btn_create_profile" /> 

blue color not platform draws you. standard buttons have selector drawable background, involves set of images view. button example standard button image, pressed button image (with blue overlay drawn above), disabled (half transparent), etc. button knows it's current state , displays appropriate image.

so want draw pressed button , create selector drawable this:

<selector xmlns:android="http://schemas.android.com/apk/res/android">      <item  android:state_pressed="true" android:drawable="@drawable/your_pressed_button/>     <item  android:drawable="@drawable/your_normal_button/>  </selector> 

i believe it's worth reading drawable resources. can find examples of button states generated here.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -