android-theme

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

How to Android Holo Theme style dialog box buttons

烂漫一生 提交于 2019-12-03 01:35:49
问题 I'm creating a Dialog Box on Holo Theme and want to follow the OS default way of displaying the buttons. So far I have created the dialog box but the buttons don't render in the way it does in the apps done in Holo for ICS. How can I do this? My intended look & feel is and I am able to reach till here 回答1: a bit late, but maybe someone is still interested in that. this works pretty good for me. ... <!-- EDIT: be carefull, "?android:attr/dividerHorizontal" is only supported since API 11 just

How to set the holo dark theme in a Android app?

百般思念 提交于 2019-12-03 01:15:33
问题 How can I set the dark holo theme in my app? At this time I got this: <style name="AppTheme" parent="android:Theme.Holo.Light" /> But when I change it to: <style name="AppTheme" parent="android:Theme.Holo.Dark" /> I get an error error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Dark'. How to solve the problem? 回答1: change parent="android:Theme.Holo.Dark" to parent="android:Theme.Holo" The holo dark theme is called Holo 回答2: By default

How to switch themes (night mode) without restarting the activity?

白昼怎懂夜的黑 提交于 2019-12-03 01:02:50
问题 I have made a few apps that support multiple themes, but I always had to restart the app when user switches theme, because setTheme() needs to be called before setContentView() . I was okay with it, until I discovered this app. It can seamlessly switch between two themes, and with transitions/animations too! Please give me some hints on how this was implemented (and animations too). Thanks! 回答1: @Alexander Hanssen's answer basically has answered this... Don't know why it was not accepted...

Can someone explain the attr?

丶灬走出姿态 提交于 2019-12-03 00:37:35
问题 I am looking at the Honeycomb Gallery sample code (here) and I ran across the following code while trying to add action items in my own app: <item android:id="@+id/camera" android:title="Camera" android:icon="?attr/menuIconCamera" android:showAsAction="ifRoom" /> The ?attr is throwing me for a loop. Can someone please explain what this is doing? How is this related to a drawable? I can't seem to find any good information on Google. Also is there a listing or gallery of attributes we can use

Toolbar Search Suggestions Theming

喜欢而已 提交于 2019-12-02 23:52:01
I’m trying to change search suggestions to “light theme”. I’m using appcompat-v7:22.2.0 library and read about new feature for customizing search view widget (android.support.v7.widget.SearchView). FIRST TRY SECTION Toolbar <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/colorPrimary" android:minHeight="?attr/actionBarSize" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" app:theme="@style

Style Android SearchView Drop down popup

痴心易碎 提交于 2019-12-02 21:02:21
I would like to know how to style the drop down popup of the Android 4.0 SearchView ? I'm using the Theme.Sherlock.Light.DarkActionBar , but I don't know how to style the drop down search into a white background and a black text? For some reason theming using the "searchAutoCompleteTextView" wasn't working for me either. So I solved it using the following code when setting up my SearchView: Note: This is all done with the android v7 support/AppCompat library public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.search_menu, menu); MenuItem searchItem = menu.findItem

How do I apply the HoloEverywhere android theme when using ActionBarSherlock?

时间秒杀一切 提交于 2019-12-02 20:59:24
I'm building an application that should work on android 2.3 and I added both ActionBarSherlock and HoloEverywhere libraries. In order to use ActionBarSherlock I have to use Theme.Sherlock like so : <application ... android:theme="@style/Theme.Sherlock" ... > And that's ok. My main activity is pretty simple : just a ListView with 5 rows (I don't use ListAcivity). <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <ListView android:id="@+id/menuListView" android:layout

Applying AppCompat theme to individual preferences in a PreferenceFragment

混江龙づ霸主 提交于 2019-12-02 20:37:45
I have been wrestling with trying to get my PreferenceFragment to have the same Material-based theme and styling (via AppCompat) as the rest of my application. The PreferenceFragment that I am using to manage all of my application settings is shown below: As you can see from the screenshot above, I was able to customize the PreferenceFragment by using colorAccent , colorPrimary , and a few other attributes. My theme for the PreferenceFragment is as follows: <style name="settingsTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <item name="colorPrimary">@color/blue_grey_500</item> <item name

Android Material Design: Failed to find style 'toolbarStyle' in current theme

社会主义新天地 提交于 2019-12-02 20:31:52
I am trying to use the toolbar widget in android 21 with a custom style but I can't get rid off this error : Failed to find style 'toolbarStyle' in current theme . Here is my layout xml file : <android.support.v7.widget.Toolbar xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/patient_toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" app:theme="@style/AppTheme.Patient" /> Here is the Patient theme : <resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light"> <!-- Customize your theme here. --> </style>