I wanna write my own keyboard view, which extends from
android.inputmethodservice.KeyboardView, and I need to get attributes
of this keyboard view. I try to override the constructor with
parameters (Context, AttributeSet, int ), and parse the attribute by
the inputed AttributeSet.

However I meet two problem.

1. My compiler tell me "android.R.styleable cannot be resolved". I can
find description of android.R.styleable in document, but my compiler
didn't know what that means.

 2. After I write my own "android.R.styleable.KeyboardView", and get
attributes by TypedArray at codes below, but the  getIndexCount() of
TypedArray return zero. I found the TypedArray's recycle() function
not be called at constructor of
android.inputmethodservice.KeyboardView. Does it a bug? how can I get
attributes from inputed
AttributeSet?

public SoftKeyboardView(Context oContext, AttributeSet oAttrs, int
iStyle)
{
        final int   iKvAttr[] =     //Arrays copy from
android.R.styleable.KeyboardView
        {
            0x00000000, //android.R.styleable.KeyboardView_shadowColor
            0x00000001, //
android.R.styleable.KeyboardView_shadowRadius
            0x00000002, //
android.R.styleable.KeyboardView_keyBackground
            0x00000003, //android.R.styleable.KeyboardView_keyTextSize
            0x00000004, //
android.R.styleable.KeyboardView_labelTextSize
            0x00000005, //
android.R.styleable.KeyboardView_keyTextColor
            0x00000006, //
android.R.styleable.KeyboardView_keyPreviewLayout
            0x00000007, //
android.R.styleable.KeyboardView_keyPreviewOffset
            0x00000008, //
android.R.styleable.KeyboardView_keyPreviewHeight
            0x00000009, //
android.R.styleable.KeyboardView_verticalCorrection
            0x0000000a  //android.R.styleable.KeyboardView_popupLayout
        };
        super(context, attrs, defStyle);
        //Parse attribute
        TypedArray  oT = context.obtainStyledAttributes(attrs,
iKvAttr, defStyle, 0);
        for(int a = oT.getIndexCount() - 1; a >= 0; a --)
        {
                ...
        }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to