android-styles

Custom attributes in styles.xml

∥☆過路亽.° 提交于 2019-11-26 19:40:44
I have created a custom widget, and I'm declaring it in layout.xml. I have also added some custom attributes in attr.xml. However, when trying to declare these attributes in a style in styles.xml, it's giving me No resource found that matches the given name: attr 'custom:attribute'. I have put the xmlns:custom="http://schemas.android.com/apk/res/com.my.package" in all of the tags in styles.xml, including <?xml> , <resources> , and <style> , but it still gives me the same error, that it can't find my custom XML namespace. I can, however, use my namespace to manually assign attributes to the

Cannot resolve symbol 'Theme' in styles.xml (Android Studio)

本小妞迷上赌 提交于 2019-11-26 19:38:18
Since today, Android Studio can't find the AppCompat themes in styles.xml, but for example AppCompatActivity in code does get recognized. My Android Studio version is 2.2.2, Build #AI-145.3360264 I already tried upgrading to the latest build tools, compile sdk (25) version etc. but it didn't fix the problem. At the moment I have installed the following (from sdk manager): android api: 19 and 23 sdk platform tools: 25.0.1 sdk tools: 25.2.3 build-tools: 23.0.2 and 25.0.1 support repository: 40 google repository: 39 and a few others, that shouldn't be necessary to list here. build.gradle of app:

How to make a smaller RatingBar?

梦想的初衷 提交于 2019-11-26 19:16:07
I've added a RatingBar in a layout: <RatingBar android:id="@+id/ratingbar" android:layout_width="wrap_content" android:layout_height="wrap_content" android:numStars="5" android:stepSize="1.0" /> But the default style for the rating bar is too large. I've try to change it by adding the android style : style="?android:attr/ratingBarStyleSmall" But the result is too small and it's impossible to set a rate with this property. How could I do? The default RatingBar widget is sorta' lame. The source makes reference to style " ?android:attr/ratingBarStyleIndicator " in addition to the " ?android:attr

Change CalendarView style

柔情痞子 提交于 2019-11-26 19:04:24
I'm trying to add a CalendarView in my application, which uses the Theme.Light theme. The problem is, the days numbers of this calendar are rendered in white, so while using a light theme, you can't see them. Right now, I have the following code in my XML layout file : <CalendarView android:id="@+id/calendar1" android:layout_width="500dp" android:layout_height="300dp"/> I tried to force the calendar theme like this : <CalendarView android:id="@+id/calendar1" android:layout_width="500dp" android:layout_height="300dp" android:theme="@android:style/Theme.Light" /> But it doesn't change anything.

how to change focus color of EditText in Android

假如想象 提交于 2019-11-26 18:39:16
How can I change the focus color (orange) on an EditText box? The focus color is a small rim around the entire control and is bright orange when the control has focus. How can I change the color of that focus to a different color? Can anyone help me in sorting out this issue? Thanks in advance, kcoppock You'll have to create/modify your own NinePatch image to replace the default one, and use that as the background of your EditText. If you look in your SDK folder, under your platform, then res/drawable, you should find the NinePatch image for the EditText focus state. If that's all you want to

Why the background of ProgressDialog doesn't set to the transparent?

岁酱吖の 提交于 2019-11-26 18:09:04
问题 I want to set the back ground to the transparent , so I have set the following code in styles.xml <style name="dialog" parent="@android:style/Theme.Dialog"> <item name="android:windowFrame">@null</item> <item name="android:windowIsFloating">true</item> <item name="android:windowContentOverlay">@null</item> <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item> <item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item> <item name="android

Transparent status bar not working with windowTranslucentNavigation=“false”

夙愿已清 提交于 2019-11-26 17:58:49
问题 I am developing an Activity where I need to make the navigation bar opaque, and the status bar transparent on devices running 5.0+ (API 21+). The styles I am using are below, along with an explanation of my problem. AppTheme extends Theme.AppCompat.Light.NoActionBar <item name="android:statusBarColor">@color/transparent</item> <item name="android:windowActionBar">false</item> <item name="android:windowDrawsSystemBarBackgrounds">true</item> <item name="android:statusBarColor">@color/welbe_red

How to change the style of a DatePicker in android?

别说谁变了你拦得住时间么 提交于 2019-11-26 17:58:00
问题 I want to change the default color of the date/time picker dialog in Android, so that it should match my app's theme. I searched for the solution on Google, but I couldn't find a solution. What I was doing was creating a new style: <style name="datepicker" parent="@android:style/Widget.DeviceDefault.DatePicker"> <!---TODO--> <item name="android:focusedMonthDateColor">@android:color/holo_red_dark</item> </style> Don't know what are the attributes available for date picker dialogue. It would be

Question mark (?) in XML attributes for Android

时间秒杀一切 提交于 2019-11-26 15:06:21
Can anyone explain the question mark means in Android XML attributes? <TextView style="?android:attr/windowTitleStyle" More attributes /> jball The question mark means it's a reference to a resource value in the currently applied theme. See the linuxtopia Android Dev Guide or the android.com Dev Guide for more about it. \? escapes the question mark. The ? lets you refer to a style attribute instead of a specific hard-coded resource . See "Referencing style attributes" in the Android Dev Guide for details. So, how is this actually useful? It makes the most sense when considering multiple themes

Change background popupMenu in Android

淺唱寂寞╮ 提交于 2019-11-26 14:38:40
问题 I tried to change background of popupmenu, but my implementation does not work. This is my code: <style name="MyHoloLight" parent="android:Theme.Holo.Light"> <item name="android:popupMenuStyle">@style/popupMenuStyle</item> </style> <style name="popupMenuStyle" parent="@android:style/Widget.PopupMenu"> <item name="android:popupBackground">@color/bgPopumMenu</item> </style> Apply in AndroidManifest.xml <application android:hardwareAccelerated="true" android:label="@string/app_name" android:icon