我是Android的初學者。我正在使用ndk應用程序。我有觸摸板類並擴展了Linearlayout。我也使用這種類型的XML文件。這個XML文件無法訪問。我下面有例外。如何訪問這個XML文件和那個類。訪問線性佈局?
<?xml version="1.0" encoding="utf-8"?>
<org.android.TouchpadLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/touchpad"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageButton
android:id="@+id/keyboard"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_alignParentRight="true"
android:background="@drawable/dreamote_btn"
android:scaleType="centerInside"
android:src="@+drawable/keyboard" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:maxHeight="48dip"
android:src="@drawable/gmote_touch_flat"
android:tint="#99000000" />
</LinearLayout>
</org.android.TouchpadLayout>
在此基礎上類
public class TouchpadLayout extends LinearLayout {
public TouchpadLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
return false;
}
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
return new BaseInputConnection(this, false) {
@Override
public boolean sendKeyEvent(KeyEvent event) {
return super.sendKeyEvent(event);
}
@Override
public boolean performEditorAction(int actionCode) {
sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
return super.performEditorAction(actionCode);
}
};
}
}
獲取例外的:
TouchpadLayout類的包名是什麼? –