In the layout file:
<Ratingbar
Style = "@ style/myratingbar" // use a style
Android: layout_marginleft = "10dip"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: Id = "@ + ID/rbar">
</Ratingbar>
In the styles. xml folder under the values folder
<? XML version = "1.0" encoding = "UTF-8"?>
<Resources>
<Style name = "myratingbar" parent = "@ Android: style/widget. ratingbar">
<Item name = "Android: progressdrawable"> @ drawable/rating_bar </item> // redefine the pattern
<Item name = "Android: minheight"> 16dip </item> // minimum height
<Item name = "Android: maxheight"> 16dip </item> // maximum height
</Style>
</Resources>
Show error message
/*** Display error message ** @ Param C * @ Param edittext * @ Param Str */public static void showedittexterror (context c, edittext, int Str) {selection. selectall (edittext. gettext (); edittext. seterror (C. getresources (). getstring (STR); edittext. requestfocus (); inputmethodmanager Imm = (inputmethodmanager) C. getsystemservice (context. input_method_service); view = (activity) c ). getcurrentfocus (); If (view! = NULL) {Imm. hidesoftinputfromwindow (view. getwindowtoken (), 0 ); // hide the soft keyboard}/*** Display error message ** @ Param C * @ Param edittext * @ Param Str */public static void showautocompletetextviewerror (context c, autocompletetextview edittext, int Str) {selection. selectall (edittext. gettext (); edittext. seterror (C. getresources (). getstring (STR); edittext. requestfocus (); inputmethodmanager Imm = (inputmethodmanager) C. getsyst Emservice (context. input_method_service); view = (activity) c). getcurrentfocus (); If (view! = NULL) {Imm. hidesoftinputfromwindow (view. getwindowtoken (), 0); // hide the keyboard }}