android-theme

Read Newer Theme Attributes On Older Platform

柔情痞子 提交于 2019-12-20 08:57:03
问题 I am trying to read attribute values from themes and styles which were designed for platforms that are newer than I am running my application on. Please don't ask why. If you know anything about the libraries I write then you should already know that I like to push the capabilities of the platform :) I am operating under the presumption that when Android styles are compiled the attribute constants are what is used for the keys and therefore should theoretically be able to be read on any

“You need to use a Theme.AppCompat theme (or descendant) with this activity” when using AppCompat theme

▼魔方 西西 提交于 2019-12-20 05:48:10
问题 I have a very strange problem with my app. After updating to the newest versions of Support libraries I get this error: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.app/com.example.app.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. This is where the exception is thrown: public class MainActivity extends AppCompatActivity { … @Override protected void onCreate(Bundle savedInstanceState

Android Styling/Theming of just Search Dialog

▼魔方 西西 提交于 2019-12-20 02:32:55
问题 tl;dr: White text style in app theme being picked up by search dialog, making search text invisible. I'm struggling mightily with what seems like a trivial issue. My app is using a dark background, and I've tweaked the text color to be brighter than the standard gray using #EEEEEE. I've implemented a Search Dialog (pre-Honeycomb) and it works well, but the text in the search dialog picks up the same #EEEEEE so it is essentially invisible. Even the context menu displayed when I long press the

Change Activity theme deppending on fragment in use Android

泪湿孤枕 提交于 2019-12-19 10:14: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

Why does Android Studio highlight “Theme” red in styles.xml?

梦想的初衷 提交于 2019-12-19 08:48:11
问题 Red highlight means Cannot resolve symbol 'Theme' Here are some configurations : styles.xml <style name="AppBaseTheme" parent="Theme.AppCompat.Light"> <!-- Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. --> <item name="android:windowNoTitle">true</item> </style> <!-- Application theme. --> <style name="AppTheme" parent="AppBaseTheme"> <item name="android:windowNoTitle">true</item> <

background issue with styles and themes

雨燕双飞 提交于 2019-12-19 08:44:09
问题 in attrs I have <attr name="bzz" format="color" /> then in theme <style name="mytheme" parent="android:Theme"> <item name="bzz">@color/aaa</item> </style> and in the code this works great tv.setBackgroundResource(R.color.aaa); but when I do this it gives me an error tv.setBackgroundResource(R.attr.bzz); I do not understand what is the problem, my logic is that I set the bzz as reference to color so that should work fine, but it does not :) it says like android.content.res.Resources

“…must supply a layout_height…” but its in my style resources?

谁说我不能喝 提交于 2019-12-19 05:13:12
问题 I had a working app on 2.1 and above until I tried to cleanup my initial layout with a theme of styles. Now the app won't even start with the "You must supply a layout_height attribute" failure message pointing to my first EditText View in the layout. Why can I not move the 'layout_height=30dp" that was working fine on every EditText into an ... item name="android:layout_height">30dp< ... in a style referred to via my theme? Virtually all my other style effects I abstracted out like this are

Android AppCompat revision 21 force Holo theme

南笙酒味 提交于 2019-12-19 02:39:13
问题 in my project I was using appcompat-v7 (revision 20), and my project was targeting android API level 19 (KitKat), so I could use Holo theme. I accidentally updated "Android Support Library" to revision 21, so I had to change the target in manifest to API level 21 (Lollipop). Because of this, my app's default theme changed to Material (e.g. checkboxes are green). Is there a way to force using Holo theme again? Manifest.xml: <manifest xmlns:android="http://schemas.android.com/apk/res/android"

No Title Bar Android Theme

别说谁变了你拦得住时间么 提交于 2019-12-18 12:17:22
问题 In my application I want to use the Theme.NoTitleBar, but on the other hand I also don't want to loose the internal Theme of the Android OS.. I searched on the net and Found the following answer.. I have modified my styles.xml and added the following line of code.. Inside values/styles.xml <style name="Theme.Default" parent="@android:style/Theme"></style> <style name="Theme.NoTitle" parent="@android:style/Theme.NoTitleBar"></style> <style name="Theme.FullScreen" parent="@android:style/Theme

Android Use custom themes to modify style attributes

谁都会走 提交于 2019-12-18 08:49:36
问题 I want to create two themes, GrayTheme and RedTheme, that modify one style attribute. For example here are my two themes, default font color is white, which is fine for both themes: <style name="RedTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar"> <item name="android:textColor">@color/white</item> </style> <style name="GrayTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar"> <item name="android:textColor">@color/white</item> </style> But I have a style that I use for Header