Questions tagged [declare-styleable]
56 questions
1
vote
1 answer
Passing string from DataBinding in to custom view xml attribute
I have situation where want to pass string in to custom view attribute, but it not working if not passing only a reference.
Working:
......
app:title="sa"
app:title="@string/winning_title"
......
Not working:

Antonis Radz
- 3,036
- 1
- 16
- 34
1
vote
1 answer
Custom views and defStyleAttr
I'm struggling with custom views defStyleAttr. (Short note I'm using a Preference as example cause it's the same way Google uses it)
So for almost every View or Preference that is provided by Android you'll have a constructor like this:
public…

CodeRed
- 481
- 4
- 17
1
vote
2 answers
Working with styleable
I wanted to make a view containing a progress view and a button. Through the view's xml I wanted to add fields that define button and porgress bar style.
What I've done so far but it does not work:

Pedro Simões
- 309
- 2
- 11
1
vote
0 answers
Facebook Shimmer integration error
While integrating Facebook shimmer, when I tried the demo project it worked fine. But now when I integrated it in my actual project its giving me the following error:
Error:(593) Attribute “shape” already defined with incompatible format
Can…

user1788109
- 11
- 4
1
vote
1 answer
getTheme().resolveAttribute() alternative on pre-lollipop
I have been struggling to obtain the styled attributes with the pre-lollipop API.
With lollipop, I use
final TypedValue statusBarColor = new TypedValue();
getTheme().resolveAttribute(android.R.attr.colorPrimaryDark, statusBarColor,…

tim687
- 2,256
- 2
- 17
- 28
1
vote
1 answer
How to get values from declare styleable TypedArray via reflection ?
I was using shape image view (https://github.com/siyamed/android-shape-imageview), and when I want to get value from declare-styleable that the shape image view define:

KenChoi
- 121
- 1
- 6
1
vote
0 answers
how to set style for custom component?
I have 2 modules:
app
- layout.xml
- styles.xml
- attrs.xml
core
- CustomComponent.java
In module core there is custom component, called CustomComponent, which I use in app module and where I want to set custom style, like…

vetalitet
- 703
- 2
- 10
- 25
1
vote
1 answer
NumberFormatException when using styleable attrs
I created a custom view for Android which renders two inner views to store a key and a value in two columns. The class looks like this:
public class KeyValueRow extends RelativeLayout {
protected TextView mLabelTextView;
protected TextView…

JJD
- 50,076
- 60
- 203
- 339
1
vote
1 answer
Android - get styleable value by name
Is there a way to get styleable by name, for example if I have string "Text" is it possible to get R.styleable.CustomView_Text value (by value I mean just index in R.styleable.CustomView array, not attribute value) without reflection?

zduny
- 2,481
- 1
- 27
- 49
1
vote
0 answers
Custom styleable for android 4.4 not available
So i have a probleme with custom styleable in android 4.4.
If anyone knows what is the problem or what is extra in android 4.4 to cause the custom styleable to not launch please help.
Here is the code i use and it works perfect on android 2.2 up to…

Tazz
- 781
- 1
- 8
- 23
1
vote
0 answers
Set static fields on custom View from XML
This is a custom view
public class MyView extends Button {
private static int color;
. . .
}
This XML instantiates MyView several times
…

ilomambo
- 8,290
- 12
- 57
- 106
1
vote
3 answers
Eclipse No Longer Recognizing Custom Attributes? (Android)
Yesterday, my project was building and running fine. Today, Eclipse decided it doesn't recognize my custom attributes anymore. I can't think of anything I changed that would cause this. I have around 2 dozen XML layouts full of custom attributes,…

ArtOfWarfare
- 20,617
- 19
- 137
- 193
0
votes
2 answers
How to programmatically add stylable attribute to a view?
I have a custom button with some stylable attributes

Iban Arriola
- 2,526
- 9
- 41
- 88
0
votes
0 answers
Get resource ID (R.string.name) of string value from Android attr in custom view
My application has a custom view, styled by attrs.xml entry:
…

ikurek
- 604
- 11
- 27
0
votes
1 answer
Custom declare-styleable not displaying text attribute
I have been working on a custom "Button" and it works just as I want it to so far. However, I am trying to add text to the button instead of a drawable (which is what I was doing before).
Currently I have used a declare-styleable in my attrs.xml…

Max Michel
- 575
- 5
- 20