android-styles

getTheme().applyStyle(…) multiple times without overwriting the previous one

橙三吉。 提交于 2019-12-11 04:23:08
问题 When I apply extra attributes to the AppTheme multiple times it overwrites the previous one. This is the code I am using: MainActivity: @Override protected void onCreate(@Nullable Bundle savedInstanceState) { getTheme().applyStyle(R.style.AppTheme_OverlayPrimaryRed); // If you change `false` to `true`, the overlay above is overwritten. if (false) { getTheme().applyStyle(R.style.AppTheme_OverlayAccentRed); } super.onCreate(savedInstanceState); ... } AppTheme.OverlayPrimaryRed: <style name=

Setting Action Bar Item Text Color?

本秂侑毒 提交于 2019-12-11 03:12:04
问题 I'm trying to set my Action bar Items' text colors by using a custom style , but it has no effect. I've tried setting: <item name="android:actionMenuTextColor">@style/AppTheme.ActionBar.Text</item> in both <style name="ActionBar" where it has no effect, and <style name="AppTheme" . If I do the latter, my app crashes with: 07-21 13:12:58.519: E/AndroidRuntime(24690): FATAL EXCEPTION: main 07-21 13:12:58.519: E/AndroidRuntime(24690): android.view.InflateException: Binary XML file line #17:

How to use Android's AppCompat theming application-wide?

人走茶凉 提交于 2019-12-11 02:19:20
问题 IDE : Android Studio 1.1.0 ENV : Debugging on usb-connected phone using Android API v10. I'm trying to use AppCompat to support Android API v8 and up. Compiles fine but crashes when the activity is drawn, saying: lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. ...however, in AndroidManifest.xml I have: <application android:name=".objects.PikCMS" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app

ActionBar AppCompat change Tab indicator color

被刻印的时光 ゝ 提交于 2019-12-11 01:36:57
问题 I have seen many posts and answers but still not clear to me, what to do if i have to change Tab indicator color without using Android Asset Studio public class MainActivity extends ActionBarActivity implements android.support.v7.app.ActionBar.TabListener{ private ViewPager tabsviewPager; private TabsAdapter mTabsAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tabsviewPager = (ViewPager)

(Material) EditText underline color

蓝咒 提交于 2019-12-11 01:29:05
问题 My problem is that I don't know how to change underline color of EditText - I have LG Nexus 5 ( Android 6 ). I would like to change normal underline color to white . I used all params like (style): colorControlNormal colorControlActivated colorControlHighlight textColorSecondary colorPrimary colorPrimaryDark e.g. <style name="FormFont" parent="@android:style/TextAppearance.Medium"> <item name="android:textColor">@color/white</item> <item name="android:textSize">@dimen/form_text_size</item>

I can't get styleable array of attrs

左心房为你撑大大i 提交于 2019-12-10 21:45:43
问题 I am declaring a styleable view with attrs, and I created the file myview_attrs.xml this simple way: <resources> <declare-styleable name="TestStyleable"> <attr name="testAttr" format="integer"/> </declare-styleable> </resources> Then, I want to load this attr in my code: void loadAttributes(AttributeSet attrs) { TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.); } After R.styleable. , with ctrl-SPACE, these are the options I am given: That is obviously wrong.

Define default values for layout_width and layout_height properties for a subclass in a style

梦想与她 提交于 2019-12-10 20:56:33
问题 Min and target SDK are 21 (Lollipop), no support library is used. I am trying to create a floating action button. So far so good, it does indeed work (based on a few other SO threads), here is the code: attrs.xml: <?xml version="1.0" encoding="utf-8"?> <resources> <attr name="fabStyle" format="reference"/> </resources> styles.xml <?xml version="1.0" encoding="utf-8"?> <resources> <style name="MyTheme" parent="android:Theme.Material.Light.NoActionBar"> <item name="floatingActionButtonStyle">

How to set CardView attributes in style.xml file in android

坚强是说给别人听的谎言 提交于 2019-12-10 17:17:04
问题 I have set a style for my CardView in style.xml file but its giving me error on compile time for app:cardCornerRadius , app:cardElevation , app:cardPreventCornerOverlap and app:contentPadding attributes. What is the correct way to set style for a CardView in Android? Below is some of my code: <style name="CardViewStyle" parent="CardView"> <item name="android:layout_marginBottom">@dimen/cardMarginVertical</item> <item name="android:layout_marginTop">@dimen/cardMarginVertical</item> <item name=

TextView color is always white for AppCompatActivity

感情迁移 提交于 2019-12-10 16:34:08
问题 The text color of a TextView is always white on pre-Marshmallow devices. Even if I am using yellow or black in my XML, it is always white except on Marshmallow. At run time it will work fine on all devices. Previously, when I was using Eclipse, everything was working find but in Android Studio it is not taking the attribute from the XML. All of the questions I have searched say to change Theme.AppCompat to Theme.AppCompat.Light but this does nothing except change white to black. I believe

Android 5.0 Lollipop: setColorFilter “leaks” onto other buttons

喜夏-厌秋 提交于 2019-12-10 12:55:32
问题 I am using setColorFilter to set the color filter of ONE of my button. This has been working perfectly until the Android 5.0 Lollipop update. Now, the color filter seems to leak onto my other buttons, even when I close the activity and reopen (it resets if I close the app and reopen). My styles.xml (v21): (same as older except here its parent is Material, before it was Holo) <style name="Theme.FullScreen" parent="@android:style/Theme.Material.Light.NoActionBar.Fullscreen"> <item name="android