[android-developers] Re: Custom View - obtain android:layout_width value

2009-10-18 Thread Mark Murphy
fhucho wrote: > I have a custom View, it is created from xml - how can I obtain the > android:layout:width value in the constructor View(Context x, > AttributeSet a) ? To get at a custom attribute, you would use code like this: TypedArray a=ctxt.obtainStyledAttributes(attrs,

[android-developers] Re: Custom View - obtain android:layout_width value

2009-10-18 Thread fhucho
I did it this way: String widthString = attrs.getAttributeValue("http:// schemas.android.com/apk/res/android", "layout_width"); // now widthString can ba for example "150px", I need to convert it to int int s = Integer.parseInt(widthString.substring(0, 3)); On Oct 18, 2:30 pm, Mark Murphy wrote

[android-developers] Re: Custom View - obtain android:layout_width value

2009-10-18 Thread Mark Murphy
fhucho wrote: > I did it this way: > String widthString = attrs.getAttributeValue("http:// > schemas.android.com/apk/res/android", "layout_width"); > // now widthString can ba for example "150px", I need to convert it to > int > int s = Integer.parseInt(widthString.substring(0, 3)); I will reiter