2013-08-06 2 views
0

Я новичок в android. Я использую приложение ndk. У меня есть класс touchpad и расширяется Linringayout. также я использую этот тип 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); 
     } 
    }; 
    } 

} 

Get Exception на: enter image description here

+0

какой пакет имя класса TouchpadLayout? –

ответ

0

ли вы попробуйте удалить это - Xmlns: андроид = "http://schemas.android.com/apk/res/android и один раз?

xmlns означает пространство имен xml. В вашем случае вы создаете пространство имен для пространства имен android

0

Вам нужно добавить пространство имен для своего класса. См. Пример here из Google.

Смежные вопросы