Questions tagged [declare-styleable]
56 questions
5
votes
2 answers
Styleable cannot be resolved
Here is the code I am using:
public ASSwitch(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray sharedTypedArray = context.getTheme().obtainStyledAttributes(
attrs,
R.styleable.ASSwitch,
…

Abdalrahman Shatou
- 4,550
- 6
- 50
- 79
4
votes
0 answers
Accessing XML enum values from code
I've declared a styleable attribute with enum values, like so:

KRyan
- 7,308
- 2
- 40
- 68
3
votes
0 answers
How to set default parameters to custom UI Class?
I have created a Custom Class called RoundedButton that extends Button. I want to assign some default parameters. How to go about it?
There was no change after I implemented the xml codes below. Basically the style was not getting added by default.…

suku
- 10,507
- 16
- 75
- 120
3
votes
2 answers
Android: method attributes
How does one accept methods as values, in attributes?
Like in the onClick attribute for a View:
How to define custom attributes that accept methods?
I know we use in resources, but how…

Alterecho
- 665
- 10
- 25
3
votes
1 answer
error MenuView, unable to find attribute android:preserveIconSpacing
I had update my eclipse Version: 4.2.2 and android SDK with API 23.
When i created an app then get an error like this.
[2015-10-12 17:03:05 - appcompat_v7] ERROR: In MenuView, unable to find attribute android:preserveIconSpacing
and warning…

Garg
- 2,731
- 2
- 36
- 47
3
votes
0 answers
Issue related to using Android attribute (attr) defined in other aar package
Assume an attr is defined in aar package (com.pack1) as
and in another package (say com.pack2 which has dependency on com.pack1) I define an styleable as

anonim
- 2,494
- 6
- 30
- 40
3
votes
1 answer
Declared XML styleable cannot be found from code
I'm trying to add a custom attribute (@drawable) to my custom View and I want to retrieve it as resourceId. Somehow my View cannot find it if I want to access it through code:
TypedArray a = context.getTheme().obtainStyledAttributes(attrs,…

Bart Burg
- 4,786
- 7
- 52
- 87
2
votes
1 answer
How to get double value from "declare-styleable"
How to get double value from declare-styleable?
attributes.xml
// Can't resolved format
Assign double value to…

Ihdina
- 950
- 6
- 21
2
votes
1 answer
How to pass the value of layout width/height to custom view class
I am creating a module having a class (roundbutton) extending linear layout. It contains an image view and a textview.
When the roundbutton view is declared in the XML file, a layout_width and layout_height values are assigned. I want the…

suku
- 10,507
- 16
- 75
- 120
2
votes
1 answer
JavaFX - How to get custom properties in scene builder?
I am looking for a solution to define editable properties of custom controls. Jens Deters built already superb custom controls with fontawesomefx for JavaFX.
After the import of the jar-files into Scene Builder you are able to use custom controls…

Namor Egnats
- 41
- 4
2
votes
2 answers
how to make enum values with | in them
I declared an android custom view
that has an enum in it
…

Lena Bru
- 13,521
- 11
- 61
- 126
2
votes
1 answer
How is declare-stylable name linked to the view that uses its attributes?
Usually al examples of custom attributes are of the form:
and its usage:
So the custom view has…

ilomambo
- 8,290
- 12
- 57
- 106
2
votes
1 answer
Why is a declare-styleable necessary if you can just read from the AttributeSet directly?
I've created a custom View subclass with the following constructor:
public MyCustomView(Context context, AttributeSet attrs)
{
super(context, attrs);
// get custom "thingy" attribute specified in XML
int thingy =…

XåpplI'-I0llwlg'I -
- 21,649
- 28
- 102
- 151
1
vote
1 answer
Is it normal to lose attribute hinting in ADT for Eclipse when using a custom Android view class in xml?
Suppose I create a custom class MyView that extends android.widget.RelativeLayout. Then I create an xml file that uses MyView

Julian A.
- 10,928
- 16
- 67
- 107
1
vote
1 answer
Add custom font to attrs.xml
I have an android application where I make use of a custom font, let's call it my_font.ttf which I have saved in my font folder in the res package.
I also have a custom number picker where I need to set the font for the values in the picker. This…
user10882820