android-styles

How to set Style for a button in Android?

谁都会走 提交于 2019-11-29 01:22:51
I have defined the below files in res folder. styles_apptheme.xml <?xml version="1.0" encoding="utf-8"?> <!-- Generated with http://android-holo-colors.com --> <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style name="ButtonAppTheme" parent="android:Widget.Holo.Light.Button"> <item name="android:background">@drawable/apptheme_btn_default_holo_light</item> </style> </resources> themes_apptheme.xml <?xml version="1.0" encoding="utf-8"?> <!-- Generated with http://android-holo-colors.com --> <resources xmlns:android="http://schemas.android.com/apk/res/android"> <style

Android Styles: Difference between 'style=“@android:style/XYZ”' and 'style=“?android:attr/XYZ”'?

孤街浪徒 提交于 2019-11-29 01:20:24
问题 I'm trying to style buttons to look like those I ask about in Android Full Width ICS style Minimalist Bottom ButtonsViews. I've succeeded, with the following xml for anyone interested: <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="bottom" android:divider="@android:drawable/divider_horizontal_dark" android:gravity="bottom" android:orientation="vertical" android:paddingTop="16dip" android:showDividers="beginning|end" >

How to programmatically create an Android theme style?

耗尽温柔 提交于 2019-11-29 01:09:34
There are lots of docs and tutorials on creating or customising an Android theme style via XML, but have not been able to find a way to create it in code. Any ideas on how to create the style in code rather than xml? This is the example XML, need to create this programmatically in code: <resources> <style name="AppTheme" parent="android:Theme.Material"> <item name="android:colorPrimary">@color/primary</item> <item name="android:colorPrimaryDark">@color/primary_dark</item> <item name="android:colorAccent">@color/accent</item> </style> </resources> short answer: Its not possible as

How to Style ActionBar, tab background on selected tab

天大地大妈咪最大 提交于 2019-11-29 00:28:28
问题 I'm struggling with styling the ActionBar. My app has an ActionBar with three tabs. I'm trying to get the selected tab to have a background color, and the unselected tabs to show a different color. I'm following this reference: Customizing Action Bar. But all the TABs are showing the Selected color. My styles.xml file is as follows: <style name="MyActionBarTabStyle" parent="android:style/Widget.Holo.Light.ActionBar.TabBar"> <item name="android:background">@drawable/tab_background</item> <item

datepicker with different style than activity

隐身守侯 提交于 2019-11-29 00:14:50
I have activities with custom style, I want my activity with a custom title bar so I created below style: <style name="costum_titlebar"> <item name="android:background">@color/titlebar_background</item> </style> <style name="CustomTheme" parent="android:Theme"> <item name="android:windowTitleSize">@dimen/titlebar_size</item> <item name="android:windowTitleBackgroundStyle">@style/costum_titlebar</item> </style> In manifest I use: <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/CustomTheme" > In the activity I

Setting Android Toolbar Background and Text Colors in Android Studio 1.4.1

被刻印的时光 ゝ 提交于 2019-11-28 23:38:40
问题 I'm trying to change activity action bar's background color and title color, i tried official tutorial and some answers from here but none worked for me , i'm missing something. styles.xml <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <

How to set checkbox border color

我是研究僧i 提交于 2019-11-28 22:44:46
The checkbox border is invisible on white background. I played with different color parameters without success. I need black border of box. Yes, there examples to make custom checkbox. In all drawable examples the normal box is visible inside of new shape. And the drawable shape is narrow without text in android:text="" . But why checkbox does not look okay in usual xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/layoutBottom1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android

Can't change the text color with Android Action Bar drop-down navigation

邮差的信 提交于 2019-11-28 22:33:40
问题 I'm using Drop-down Navigation with my Action bar, and I can't get a sensible color for the corresponding text when using a dark action bar. The action bar itself is a dark grey, and the text color is black, so it's very hard to read. I followed the basic instructions on the Action Bar developer's guide so my code is simply SpinnerAdapter mSpinnerAdapter = ArrayAdapter.createFromResource(this, R.array.action_list, android.R.layout.simple_spinner_dropdown_item); ActionBar.OnNavigationListener

Difference between android:windowBackground and android:colorBackground?

戏子无情 提交于 2019-11-28 17:50:20
What is the difference between android:windowBackground and android:colorBackground ? Example: <style name = "theme"> <item name ="android:windowBackground">@color/black</item> <item name ="android:colorBackground">@color/black</item> </style> Which one would affect the color you see when a new activity is loading? windowBackground only affects the main window's background. colorBackground affects not only the background of the main window but also of all components e.g. dialogs unless you override it in the component layout. So both of them change the activity's background, but the

Android AlertDialog with rounded corners

空扰寡人 提交于 2019-11-28 16:13:53
I have been trying to make my Alert Dialog with rounded corners but somehow I am not able to. I have tried and I failed. I tried to follow this blog http://blog.stylingandroid.com/archives/271 and made my styles based on that. Btw, to add to my question now. Some of my new finding. The code in the above link just works fine on 2.3.3 (GB) but does not work at all in ICS . Some change made the code to break. I want to avoid creating 9 patch images and thus I am using shapes. 9 patch image is the last thing that I will try.I know that android alert dialog style is using 9 patch image. I already