Reputation: 1145
As I am clicking on button but it is not showing pressed state. Please help. thanks
my code:
<item name="android:textColor" >#000</item>
<item name="android:textSize" >20dp</item>
<item name="android:background">@drawable/note_icon</item>
</style>
button
android:id="@+id/createnote"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/Createnote"
style="@style/Create_text" />
This is my layout and code:
createnote.setOnClickListener(new OnClickListener(){
public void onClick(View v) {
// TODO Auto-generated method stub
// v.setPressed(true);
Intent intent = new Intent(getApplicationContext(), Add_Task.class);
startActivity(intent);
}
});
Upvotes: 1
Views: 722
Reputation: 1328
Have you created a selector to define comportment when the button is pressed ?
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_enabled="false"
android:drawable="@drawable/btn_XXXX" />
<item
android:state_pressed="true"
android:state_enabled="true"
android:drawable="@drawable/btn_YYYY" />
<item
android:state_focused="true"
android:state_enabled="true"
android:drawable="@drawable/btn_ZZZZ" />
<item
android:state_enabled="true"
android:drawable="@drawable/btn_WWWWW" />
</selector>
Upvotes: 2