Recent Posts

Site Creator

Giving Visual Feedback to User and Increase App Engagement

Posted on

Dear Fellow Developers

Increasing app engagement is the goal that is in the mind of Every app developer. Why ? because this gives an opportunity to app developer to monetise app.

 

In my another article Link I demonstrated a way where shape drawables can be used to enhance UI of application and at the same doing this doesn’t increase apk size considerably.

 

Today we gonna use another shape drawable called StateListDrawable popularly known as selectors . Lets take example of button. A button has few states like pressed, focused , normal etc . By using selectors we can actually provide different drawable resources for different states of button.  Have a look at below xml

 

 

So you can see we have provided different drawable resources for different state. Now you just have to do one thing that you need to set android:background property of your Button element in xml , as this selector file

 

Now whenever you run your application and press button it will give visual feedbacks to different states of button.

 

Now for a textview where we want to change the textcolor on some event , we need to modify our selector. Rather than using android:drawable attribute in selector we directly use android:color attribute. So below is our resulting xml.

 

 

Now you can use this selector as a value of textColor attribute of your textView.

 

 

 

Thanks for reading.

 

Happy Coding.

 

 

 

 







Disclaimer: The aforesaid writeup by Relsell Global writer is for the general understanding of the readers. It does not render any professional advice or opinion.

SHARE THIS PAGE!