advansis Active Member Licensed User Longtime User Aug 26, 2018 #1 Hi to everybody, I would like to modify my theme (I'm using AppCompat themes). I'm already able to change colors and paddings with "CreateResource/style" in Manifest editor. Now I need to change background of my editext-views such as they will have round borders. Is it possible throught Manifest editor ? Thanks in advance.
Hi to everybody, I would like to modify my theme (I'm using AppCompat themes). I'm already able to change colors and paddings with "CreateResource/style" in Manifest editor. Now I need to change background of my editext-views such as they will have round borders. Is it possible throught Manifest editor ? Thanks in advance.
Semen Matusovskiy Well-Known Member Licensed User Aug 26, 2018 #2 Imagine that you manifest looks so: Code: Copy SetApplicationAttribute (android:theme, "@style/MyAppTheme") CreateResource (values, theme.xml, <resources> <style name="MyAppTheme" parent="Theme.AppCompat.NoActionBar"> ... </style> </resources> ) Do following: 1) Create own oval shape Code: Copy CreateResource (drawable, myshape.xml, <shape ...></shape>) 2) In theme.xml add your custom style Code: Copy <style name="App_EditTextStyle" parent="Widget.AppCompat.EditText"> <item name="android:background">@drawable/myshape</item> ... </style> 3) Inside <style name="MyAppTheme" ...></style> add reference Code: Copy <item name="editTextStyle">@style/App_EditTextStyle</item> Attachments test.zip test.zip 7.7 KB · Views: 365 Last edited: Aug 26, 2018 Upvote 0
Imagine that you manifest looks so: Code: Copy SetApplicationAttribute (android:theme, "@style/MyAppTheme") CreateResource (values, theme.xml, <resources> <style name="MyAppTheme" parent="Theme.AppCompat.NoActionBar"> ... </style> </resources> ) Do following: 1) Create own oval shape Code: Copy CreateResource (drawable, myshape.xml, <shape ...></shape>) 2) In theme.xml add your custom style Code: Copy <style name="App_EditTextStyle" parent="Widget.AppCompat.EditText"> <item name="android:background">@drawable/myshape</item> ... </style> 3) Inside <style name="MyAppTheme" ...></style> add reference Code: Copy <item name="editTextStyle">@style/App_EditTextStyle</item>
advansis Active Member Licensed User Longtime User Aug 27, 2018 #3 Thank you very much. Works correctly! Any clue for using it with spinners ? I used the "spinnerStyle" attribute, but now I cannot see the selection arrow anymore. Upvote 0
Thank you very much. Works correctly! Any clue for using it with spinners ? I used the "spinnerStyle" attribute, but now I cannot see the selection arrow anymore.
Semen Matusovskiy Well-Known Member Licensed User Aug 27, 2018 #4 Spinners have more complex style. it's possible to "correct" also (using, for example, information from https://android.googlesource.com/platform/frameworks/support/+/refs/heads/master/v7/appcompat ). But, I think, to correct styles for all EditText/Spinners and etc. is a wrong way. First of all, because users expect classic view. I can imagine that you want to highlight some fields, for example, using oval border. Personally I would use another approach. I would place edittext/spinner on transparent panel. For panel I would set selector with shapes. Upvote 0
Spinners have more complex style. it's possible to "correct" also (using, for example, information from https://android.googlesource.com/platform/frameworks/support/+/refs/heads/master/v7/appcompat ). But, I think, to correct styles for all EditText/Spinners and etc. is a wrong way. First of all, because users expect classic view. I can imagine that you want to highlight some fields, for example, using oval border. Personally I would use another approach. I would place edittext/spinner on transparent panel. For panel I would set selector with shapes.
advansis Active Member Licensed User Longtime User Aug 27, 2018 #5 You are right, I would like to highlight some fields for error handling in user forms. If I change the color for a wrong value of a spinner, the arrow disappears... Instead of using other panels, I'll try to draw directly on the activity/panel canvas containing the views... (by surrounding each view with a rectangle, for example) Thanks a lot! Upvote 0
You are right, I would like to highlight some fields for error handling in user forms. If I change the color for a wrong value of a spinner, the arrow disappears... Instead of using other panels, I'll try to draw directly on the activity/panel canvas containing the views... (by surrounding each view with a rectangle, for example) Thanks a lot!