Craig wrote:
It well could be over complicated - here is what I did:
In res, values, attrs.xml I have:
?xml version=1.0 encoding=utf-8?
resources
declare-styleable name=MyColors
attr name=inactiveColor format=color/
attr name=activeColor format=color/
skink wrote:
int activeColor = myColors.getInteger
(R.styleable.MyColors_activeColor, 0);
int inactiveColor = myColors.getInteger
(R.styleable.MyColors_inactiveColor, 0);
just after posting i realized i use getInteger, which is wrong of
course (however it also works...)
it should be
Thank you, skink - that is much simpler.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this
On 1 Lut, 16:07, Craig csab...@gmail.com wrote:
Thank you, skink - that is much simpler.
you probably were not aware of generated R.styleable... note that
R.styleable.MyColors contains int[] you created by hand while
R.styleable.MyColors_* contains indices to that table
take a look here:
http://code.google.com/p/android-titlebar/
http://www.anddev.org/my_own_titlebar_backbutton_like_on_the_iphone-t4591.html
and here:
http://code.google.com/p/android-misc-widgets/
http://www.anddev.org/making_own_theme-t4052.html
greetings,
darolla
2009/1/31 Craig
I'm sorry if I missed it, but I didn't see what I was looking for
behind any of those links. I know I can create a custom theme to use
android attributes; what I want to do is create a custom theme with
custom attributes, and refer to those in my code.
Craig wrote:
I'm sorry if I missed it, but I didn't see what I was looking for
behind any of those links. I know I can create a custom theme to use
android attributes; what I want to do is create a custom theme with
custom attributes, and refer to those in my code.
hi,
all you need to do
Thanks! That did it. Here is an example of the code I used:
final private static int[] colorAttrs = new int[]
{R.attr.activeColor, ...};
I chained my View constructors:
public MyView(Context context) {this(context, null);}
public MyView(Context context, AttributeSet attrs) {this(context,
Craig wrote:
Thanks! That did it. Here is an example of the code I used:
final private static int[] colorAttrs = new int[]
{R.attr.activeColor, ...};
I chained my View constructors:
public MyView(Context context) {this(context, null);}
public MyView(Context context, AttributeSet
It well could be over complicated - here is what I did:
In res, values, attrs.xml I have:
?xml version=1.0 encoding=utf-8?
resources
declare-styleable name=MyColors
attr name=inactiveColor format=color/
attr name=activeColor format=color/
10 matches
Mail list logo