android-styles

ResourcesCompat.getDrawable() vs AppCompatResources.getDrawable()

此生再无相见时 提交于 2019-12-03 04:40:46
问题 I'm a bit confused with these two APIs. ResourcesCompat.getDrawable(Resources res, int id, Resources.Theme theme) Return a drawable object associated with a particular resource ID and styled for the specified theme. Various types of objects will be returned depending on the underlying resource -- for example, a solid color, PNG image, scalable image, etc. Prior to API level 21, the theme will not be applied and this method simply calls through to getDrawable(int). AppCompatResources

applying a theme to an appwidget

泪湿孤枕 提交于 2019-12-03 03:21:59
i'm trying to define a theme for an appwidget, and have it applied at the application level. i have a theme like, <style name="theme.dark"> <item name="android"background">#000000</item> </style> in my manifest, i set android:theme="@style/theme.dark" at the application. however, when i run the appwidget, it does not pick up the items from the style. i tried setting style="@style/theme.dark" on an individual element in my view layout, and that does work ... but that's not what i want. i don't want to call out a specific style="..." for each element in my view. this page, http://www

Android TimePickerDialog styling guide/docs?

巧了我就是萌 提交于 2019-12-03 03:02:35
I'm trying to style a TimePickerDialog for sdk 21+ (Lollipop). So far I've figured out how to change the default colorscheme in XML: <style name="TimePickerTheme" parent="@style/Theme.AppCompat.Light.Dialog"> <item name="colorPrimary">#ff2d6073</item> <!-- no effect --> <item name="colorPrimaryDark">#ff2d6073</item> <!-- no effect --> <item name="colorAccent">#ff2d6073</item> <item name="android:textColor">#ffD0D102</item> <item name="android:textColorPrimary">#ffD0D102</item> </style> This works but I'm looking for a guide or documentation for all the properties I can change. AccentColor does

Remove black background on custom dialog

断了今生、忘了曾经 提交于 2019-12-03 02:37:00
问题 I want to remove the black background on custom dialog as shown in the picture. I'm sure the black background was from the dialog, not from app's background. ; AlertDialog code public class MyAlertDialog extends AlertDialog { public MyAlertDialog(Context context) { super(context); } public MyAlertDialog(Context context, int theme) { super(context, theme); } } Activity code public void showMyDialogOK(Context context, String s, DialogInterface.OnClickListener OkListener) { MyAlertDialog

How can I get the primary color from my app theme?

。_饼干妹妹 提交于 2019-12-03 02:21:18
In my Android java code, how can I reference the color "colorPrimary" set in my theme? I have the following theme definition: <!-- Application theme. --> <style name="AppTheme" parent="AppBaseTheme"> <item name="colorPrimary">@color/myColor1</item> <item name="colorPrimaryDark">@color/myColor2</item> <item name="colorControlNormal">@color/myColor3</item> <item name="colorControlActivated">@color/myColor4</item> </style> I could reference the color resource directly (R.color.myColor1), but I would prefer to reference the theme's primaryColor setting, so that it stays consistent if the

Styling android search view and drop down list in actionbar

荒凉一梦 提交于 2019-12-03 02:06:01
In my app, I have a searchview that displays search suggestions. I want the dropdown/spinner and text to be a particular color. Currently the only change I've been able to make is the text color of the inputted text via the following: <style name="MyApp.AutoCompleteTextView" parent="Widget.AppCompat.Light.AutoCompleteTextView"> <item name="android:textColor">@color/white</item> <item name="android:textCursorDrawable">@null</item> <item name="android:background">@color/myBackgroundColor</item> </style> The app currently displays the searchview results like this: What I would like to know is how

How to give the user the possibility to switch between different colors skin in your App

余生颓废 提交于 2019-12-03 00:28:42
I want to give the user the opportunity to select wich color skin will have the app. For example, i whould implement a black skin with black colours with different tonalities and also a white skin with withe tonalities. Which whould be the best approach to achieve this? For example i know that there is a colors.xml file in Android that should contain the colours of your app. Whould be a way to have two colors files or something and to use one or other depending of user selection? Maybe a styles.xml file? Please tell me your opinion about which whould be the best approach to achieve this Thank

Example and explanation: Android (Studio) Login Activity Template generated activity

大兔子大兔子 提交于 2019-12-03 00:16:50
问题 I wanted to implement a login form in my app, so I tried to use the code generated by the Android Studio Wizard for a new Activity of type Login Form. i think that the code generated by Eclipse is almost the same. Unfortunately, the generated code did not provide the expected result: I created a nice simple login form, but with correct or wrong password, it does not move from the login form. Also I noticed that no "Register" form was created. After looking a bit, and analyzing the code, I

Change the color of selected date only in date picker android

允我心安 提交于 2019-12-02 18:22:58
问题 I am using date picker and I need to style it with different colors. All things are working fine except the selected date color. The thing is selected date color takes "android:textColorPrimaryInverse" as default which in my case is red , background of the dialog is white and the "android:colorControlHighlight" and "android:colorControlActivated" is also red. This means the selected text color doesn't show.I need that to be shown as white but the issue is if I change"android

What is difference among styles.xml and themes.xml

时间秒杀一切 提交于 2019-12-02 16:29:59
May I know what is the difference between styles.xml and themes.xml ? To me, they just look same as both XML are in the same format. <style name="... <item name="... So, in my app which provide customization coloring, size, drawable, ... do I need both styles.xml and themes.xml as well? How should I decide which XML to put in which file? Out of the whole page of the Styles and Themes . You may be looking for this line. When you apply a style to a single View in the layout, the properties defined by the style are applied only to that View. If a style is applied to a ViewGroup, the child View