0

我使用后SoftKeyBoardListener并创建一个自定义类,但是当我在活动课调用它,所以得到一个例外InflateException使用softkeyboard布局

04-01 15:45:28.105: E/AndroidRuntime(21534): java.lang.RuntimeException: Unable to start activity ComponentInfo{mypackage/mypackage.Settings}: android.view.InflateException: Binary XML file line #2: Error inflating class LinearLayoutThatDetectsSoftKeyboard 

04-01 15:45:28.105: E/AndroidRuntime(21534): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100) 

布局

<?xml version="1.0" encoding="utf-8"?> 
    <LinearLayoutThatDetectsSoftKeyboard 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/settings" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical" 
     android:background="@color/white" > 


    </LinearLayoutThatDetectsSoftKeyboard> 

我也在清单中定义如下

<activity 
     android:name="mypackage.Settings" 
     android:screenOrientation="portrait" 
     android:windowSoftInputMode="adjustResize" /> 

调用它活动的onCreate作为

LinearLayoutThatDetectsSoftKeyboard mainLayout = (LinearLayoutThatDetectsSoftKeyboard)findViewById(R.id.settings); 
     mainLayout.setListener(this); 

,并执行了LinearLayoutThatDetectsSoftKeyboard.Listener以及。

因此如何引用延伸的LinearLayout到活动的键盘显示/隐藏监听器自定义类

回答

0

提供布局声明完整的类名称:

<your.package.name.LinearLayoutThatDetectsSoftKeyboard 
... your layout params 
/> 
相关问题