android-theme

Best way to change individual views styles in a multi Theme app

别说谁变了你拦得住时间么 提交于 2019-12-07 08:54:55
问题 I have a ListView with a BaseAdapter that can have many different inflated views . I'm implementing tree Themes that user can choose from within the app. Everything was great until I needed to change the appearance of a row TextView in the ListView depending on the Theme user has chosen. I have a solution where I'm on the fly testing like this: @Override public View getView(int position, View convertView, ViewGroup parent) { int type = getItemViewType(position); ViewHolder viewHolder = null;

Customize Padding of ActionBar Tabs Support

半腔热情 提交于 2019-12-07 06:49:14
问题 I want to remove the padding (spaces) between the tabs of the ActionBar. I am using the Android Support Library V7 (Appcompat) to use Fragments and the ActionBar in Android 2.2 API 8 as minSDK and 4.4 API 19 as maxSDK. I have tried the following but it does not change anything. My styles.xml <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light"> </style> <style name="AppTheme" parent="AppBaseTheme"> <item name="

How to fix cut-off custom SearchView background in landscape?

心不动则不痛 提交于 2019-12-07 05:46:44
问题 I've followed the great answer for this question to make the SearchView widget in my ActionBar fit a custom theme. It works just fine for portrait mode, but in landscape the OS will shrink the height of the ActionBar to maximize content screen estate. Instead of fitting the SearchView widget without margins into the ActionBar just like the other items, it is chopped off at the top: I've dug through the res-folder of the Android source, but could not find any specialized layouts or resources

Android: cannot resolve appcompat-v7 themes

余生长醉 提交于 2019-12-07 04:17:09
问题 In themes.xml , I would like to change a theme from Theme.Holo.Light.DarkActionBar to Theme.AppCompat.Light.DarkActionBar but I get: cannot resolve symbol '@android:style/Theme.AppCompat.Light.DarkActionBar' In the gradle file I added: compile 'com.android.support:appcompat-v7:22.1.1' I am using: compileSdkVersion 22 buildToolsVersion "22.0.1" I have also run gradle's clean command, but nothing seems to change. Any ideas? 回答1: The AppCompat themes are not part of the built-in styles. You have

Adding TextInputLayout dynamically throws Exception

喜欢而已 提交于 2019-12-06 14:29:20
问题 I have been trying to add a TextInputLayout dynamically. Whenever a RadioButton will be clicked, a TextInputLayout will be added under a LinearLayout . But after all this, I am getting an exception -- java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the design library. Although the app is not crashing, but the code below the point of this error is not getting executed. I have searched all over StackOverflow and other websites as well, looking

Android Action Bar not showing on displayOptions - useLogo

大憨熊 提交于 2019-12-06 11:03:34
问题 I have an actionBarStyle that I have implemented in my app for my ActionBar . Here is the xml code below: <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="MyActionBarTheme" parent="@android:style/Theme.Holo"> <item name="android:windowActionBarOverlay">true</item> <item name="android:actionBarStyle">@style/MyCustomActionBar</item> </style> <style name="MyCustomActionBar" parent="@android:style/Widget.Holo.ActionBar"> <item name="android:background">@android

Change Activity Theme From a Fragment

主宰稳场 提交于 2019-12-06 09:33:47
I have a settings PreferenceFragment that allows the user to select a theme. The user can select a dark or light theme. After selecting a theme the user presses the back button to return to the previous fragment. This called the containing activity's onCreate method where the theme is read and applied. However the theme is not applied correctly, Switching from Holo.Light to Holo.Dark changes the background colour, action bar etc but does not change the text resulting in faded, hard to read text. Any ideas what I am doing wrong? Everything I have read says that the theme should be applied in

Set a theme on a View programmatically on Android 5.0 Lollipop

跟風遠走 提交于 2019-12-06 08:20:46
问题 Android 5.0 Lollipop added the ability to set a theme for different views (not just the Activity). android:theme="@style/MyAwesomeTheme" Is there a way to set the theme on a view dynamically? 回答1: android:theme changes specific attributes specified in the theme resource. You could instantiate specific view using any overloaded constructor, like View(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) . which basically is what inflater does. For example v7.widget.Toolbar

Xamarin Forms custom theme not working

倾然丶 夕夏残阳落幕 提交于 2019-12-06 07:42:50
I have an Android app that uses Xamarin Forms 2.0. I made a custom theme to set some colors. I created these files: Resources/values/styles.xml (AndroidResource) <?xml version="1.0" encoding="utf-8" ?> <resources> <style name="SmartbitLight" parent="SmartbitLight.Base"> </style> <style name="SmartbitLight.Base" parent="Theme.AppCompat.NoActionBar"> <item name="colorPrimary">@color/blueLight</item> <item name="colorPrimaryDark">@color/blueDark</item> <item name="colorAccent">@color/grey</item> <item name="android:windowBackground">@color/white</item> <item name="android:textColorPrimary">@color

How to change the autocomplete text color for search view inside of ActionBarSherlock with dark background?

て烟熏妆下的殇ゞ 提交于 2019-12-06 06:16:20
问题 I have my own theme for ActionBarSherlock based on Theme.Sherlock.Light.DarkActionBar , here are my styles: <style name="Theme.MyTheme" parent="Theme.Sherlock.Light.DarkActionBar"> <item name="actionBarStyle">@style/Widget.MyTheme.ActionBar</item> </style> <style name="Widget.MyTheme.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse"> <item name="android:background">@drawable/action_bar</item> <item name="background">@drawable/action_bar</item> </style> Where @drawable/action