android-styles

Change Activity theme deppending on fragment in use Android

故事扮演 提交于 2019-12-01 10:50:12
I have an activity that switches between several fragments. This activity has a default style, but when i change to some particular fragments i want it to change the style. I've done some research and i got this code that i run in the onCreateView() of a fragment: // create ContextThemeWrapper from the original Activity Context with the custom theme Context context = new ContextThemeWrapper(getActivity(), R.style.GreyTheme); // clone the inflater using the ContextThemeWrapper LayoutInflater localInflater = inflater.cloneInContext(context); // inflate using the cloned inflater, not the passed

How can I create my own theme for alertDialog?

谁说胖子不能爱 提交于 2019-12-01 09:53:32
问题 I want to create a different theme for all of alertDialog instances. I need my own title view instead of the usual black title background. All text should have a blue color, and set the edge of the alertDialog to a round shape. Is it possible to create our own theme for alert dialogs, using any style or creating a class which extends AlertDialog.Builder ? I need a common theme or style for my all instances of alertDialog. I am using alertDialog in many places - one for singleChoice items, one

Change default design theme to customized color

左心房为你撑大大i 提交于 2019-12-01 08:17:18
I am very new to Android Studio. As a beginner I have created a simple app just for testing purpose and to view the appearance of Android studio material theme. I am currently working with latest version ie. L preview - Studio 0.8.2 version. Here, I have just created textview, edittext, radio buttons and checkboxes. When I select male or female, it appears sky blue color. Could I be able to change sky blue color as a green or yellow color? I do not know what is the name for that. From the picture can able to see edittext, radio buttons and checkboxes selected state as a sky blue color. When I

java.lang.UnsupportedOperationException: Can't convert to color: type=0x1

若如初见. 提交于 2019-12-01 06:06:30
问题 I've been following throught the myfirstapp guide on Android developers training but I've come across a problem where they do not properly explain how to define colors. They mention that to create a custom theme, you can declare your text colors as such: themes.xml <?xml version="1.0" encoding="utf-8"?> <resources> <!-- the theme applied to the application or activity --> <style name="CustomActionBarTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar"> <item name="android

Set style on TableRow in Android

纵饮孤独 提交于 2019-12-01 03:46:17
Using the Android SDK, there doesn't seem to be any way to set the style on a table row. I want to do the equivalent of: <TableRow style='@style/TableRow_classic' > in code. I would like something like: TableRow row = new TableRow(this); row.setStyle(R.style.TableRow_classic); Does anyone know how to find this? The best solution I've found to accomplish this is to create a "partial" layout representing the table row, with a style defined: <?xml version="1.0" encoding="utf-8"?> <TableRow xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout

Changing button style in the whole application

家住魔仙堡 提交于 2019-12-01 03:43:46
I'm trying to change all the TextColor of my buttons in my app to white and also trying to make it bold. But that isn't happening, I'm overwriting the android:Widget.Button I'm developing for Jelly Bean 4.1.2 What am I doing wrong? Theme definition in manifest android:theme="@style/spui" > The theme where I like to <style name="spui" parent="android:Theme.Holo.Light.DarkActionBar"> <item name="android:buttonStyle">@style/Buttonspui</item> </style> The style for the button itself <style name="Buttonspui" parent="android:Widget.Button"> <item name="android:background">@drawable/btn_default_holo

Two different styles in a single textview with different gravity and height

不打扰是莪最后的温柔 提交于 2019-12-01 03:40:15
I am looking for a textview which looks like . I have used below code for the implementation of this.. SpannableString text; text = new SpannableString(bal_dollars.getText()); int index = bal_dollars.getText().toString().indexOf("."); text.setSpan(new TextAppearanceSpan(getApplicationContext(), R.style.HeroGraphicBalanceSmallFont), index, bal_dollars .getText().toString().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); bal_dollars.setText(text, TextView.BufferType.SPANNABLE); here is the style used in the span.. <style name="HeroGraphicBalanceSmallFont" parent="@android:style/TextAppearance

Android text styling error - Resource is not a ColorStateList

柔情痞子 提交于 2019-12-01 02:17:50
问题 I have a very simple textview: <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/app_name" android:textSize="20sp" android:textColor="@style/basic_text_color" android:layout_gravity="center" android:id="@+id/toolbar_title" /> Which @style/basic_text_color is a color that I wanted to reuse a lot of time in the app, so I make a app_colors.xml under values folder: <?xml version="1.0" encoding="utf-8"?> <resources> <!-- Text colors style-->

Two different styles in a single textview with different gravity and height

时间秒杀一切 提交于 2019-12-01 00:59:32
问题 I am looking for a textview which looks like . I have used below code for the implementation of this.. SpannableString text; text = new SpannableString(bal_dollars.getText()); int index = bal_dollars.getText().toString().indexOf("."); text.setSpan(new TextAppearanceSpan(getApplicationContext(), R.style.HeroGraphicBalanceSmallFont), index, bal_dollars .getText().toString().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); bal_dollars.setText(text, TextView.BufferType.SPANNABLE); here is the style

Changing button style in the whole application

若如初见. 提交于 2019-12-01 00:54:52
问题 I'm trying to change all the TextColor of my buttons in my app to white and also trying to make it bold. But that isn't happening, I'm overwriting the android:Widget.Button I'm developing for Jelly Bean 4.1.2 What am I doing wrong? Theme definition in manifest android:theme="@style/spui" > The theme where I like to <style name="spui" parent="android:Theme.Holo.Light.DarkActionBar"> <item name="android:buttonStyle">@style/Buttonspui</item> </style> The style for the button itself <style name=