Hello,
I have a trouble creating a custom View. When I inflate my xml layout, the com.example.pawel.testapp.CustomKeyboardView tag is ignored. What I do is:
In the SimpleIME.java:
Code:
public View onCreateInputView() {
...
LinearLayout ll= (LinearLayout)getLayoutInflater().inflate(R.layout.input,null);
List<View> list = ll.getFocusables(View.FOCUS_FORWARD);
Log.d("App:", "isEmpty:"list.isEmpty());
//todo
for(View item : list){
Log.d("App:", item.toString());
}
...
In the input.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.example.pawel.testapp.CustomKeyboardView
android:id="@+id/input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:keyPreviewLayout ="@layout/preview"
>ddd</com.example.pawel.testapp.CustomKeyboardView>
<Button android:layout_width="match_parent"
android:layout_height="wrap_content" >
</Button>
</LinearLayout>
In the values/attrs.xml:
Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="CustomKeyboardView">
<attr name="android:text"/>
<attr name="android:textColor"/>
<attr name="extraInformation" format="string" />
</declare-styleable>
</resources>
The console output is like:
Code:
05-19 09:44:02.089 6658-6658/? D/App:﹕ isEmpty:false
05-19 09:44:02.089 6658-6658/? D/App:﹕ android.widget.Button{301650d5 VFED..C. ......I. 0,0-0,0}
When I delete the Button tag the list becomes empty. I think it means that there's something missing here, so that the inflate method can interpret my CustomKeyboardView proprerly. What should I do?