android-xml

Programmatically change color of shape in layer list

↘锁芯ラ 提交于 2019-11-30 02:55:35
How can I programmatically change the color ( #000000 ) of a shape in a layer list? Here is my layer list: <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <solid android:color="#000000" /> // CHANGE THIS COLOR </shape> </item> <item android:left="5dp"> <shape android:shape="rectangle"> <solid android:color="@color/bg" /> </shape> </item> </layer-list> First of all you need to assign id to you layer-list item. <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <!-- First assign id to the list item--> <item

(can't find id reference) No resource matches the given name at

时间秒杀一切 提交于 2019-11-30 01:40:51
问题 I have the following inside a relative layout. <TextEdit android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@id/buttonA" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_toLeftOf="@id/buttonA" /> <Button android:id="@+id/buttonA" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:text="@string/message" > </Button> Eclipse gives me

What is android:includeFontPadding for?

江枫思渺然 提交于 2019-11-30 01:13:44
问题 You can use android:includeFontPadding="false" to get rid of the default padding in a TextView . Android docs say this about the attribute: Leave enough room for ascenders and descenders instead of using the font ascent and descent strictly. Questions: What does the above mean? What is this padding used for? Is it bad to turn it off and why? 回答1: This is need for text size measure in height. If you turn it off, text will be forced to be some height, otherwise it will calculate height of each

how to change color of the actual scroll in ScrollView android?

馋奶兔 提交于 2019-11-29 23:36:20
I'm wondering if it's possible to change the color of the ScrollView. I'm not referring to the background color or the edges. I attached a print screen of the bar I'm referring. For me, it's kind of transparnt. Here's how I defined it in the xml: <ScrollView android:layout_width="wrap_content" android:layout_height="wrap_content" android:fadeScrollbars="false" android:layout_toLeftOf="@+id/personalscores_BackButton" android:layout_marginRight="0dp" > Create a scroll bar in drawable(scrollbar.xml) using this <shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res

How to concatenate multiple strings in android XML? [duplicate]

北城余情 提交于 2019-11-29 23:26:26
This question already has an answer here: Reference one string from another string in strings.xml? 10 answers Problem I would like to be able to do something like that in Android XML code: <string name="title">@string/app_name test</string> <string name="title2">@string/app_name @string/version_name</string> Regarding first line of code compiler shows this error No resource found that matches the given name (at 'title' with value '@string/app_name test') and regarding second line of code compiler shows this error No resource found that matches the given name (at 'title2' with value '@string

How can I create a weekly calendar view for an Android Honeycomb application?

自作多情 提交于 2019-11-29 23:13:02
I am working on an Android (v3.0) application that has a requirement of mimicking the weekly calendar layout found on Google Calendar: The events will be based on external requests through the Google Calendar API (I already have this part working). Using the API, I can obtain a list of events for the week, with each event having a starting and and ending datetime. I would like to use this data to show the scheduled events to the application's users in a view similar to the one above. Here's what I have so far: The XML appears below: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns

How do I use obtainStyledAttributes(int []) with internal Themes of Android

佐手、 提交于 2019-11-29 23:08:36
So I have looked around and found out that android.R.styleable is no longer part of the SDK even though it is still documented here . That wouldn't really be an issue if it was clearly documented what the alternative is. For example the AOSP Calendar App is still using the android.R.styleable // Get the dim amount from the theme TypedArray a = obtainStyledAttributes(com.android.internal.R.styleable.Theme); lp.dimAmount = a.getFloat(android.R.styleable.Theme_backgroundDimAmount, 0.5f); a.recycle(); So how would one get the backgroundDimAmount without getting the int[] from android.R.styleable

Android shape with gradient border and shadow

守給你的承諾、 提交于 2019-11-29 20:13:03
问题 I have a png drawable for the buttons. But it image drawable has gradient and it looks bad when applying 9patch (gradient & 9patch non compatible). I want to do this with a shapes. But I can't drawing with android shapes because it's hard to me to understand it. Can you help me to draw this image with a shapes? It's contain a border gradient, orange rectangle inside with a rounded corners and shadow 120° 回答1: Here you go Create your layout <?xml version="1.0" encoding="utf-8"?>

dpi value of default “large”, “medium” and “small” text views android

一世执手 提交于 2019-11-29 19:03:49
Does the documentation ( or anyone) talks about the dpi values of the default Large TextView { android:textAppearance="?android:attr/textAppearanceLarge" } Medium TextView { android:textAppearance="?android:attr/textAppearanceMedium" } Small TextView { android:textAppearance="?android:attr/textAppearanceSmall" } widgets in the SDK ? To put it in another way, can we replicate the appearance of these text views without using the android:textAppearance attribute? biegleux See in the android sdk directory. In \platforms\android-X\data\res\values\themes.xml : <item name="textAppearanceLarge">

How to draw a dot circle inside a square drawable in android?

久未见 提交于 2019-11-29 17:53:24
I want a small dot inside a square button , this is what i have tried till now as answered by azizbekian: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <size android:width="100dp" android:height="100dp"/> <solid android:color="#38b0ef"/> </shape> </item> <item android:bottom="45dp" android:left="45dp" android:right="45dp" android:top="45dp"> <shape android:shape="oval"> <stroke android:width="1dp" android:color="#0c5069"/> <size android:width="20dp" android:height="20dp"/> <solid android