1

csipsimple をライブラリとして再利用しようとしています。同じライブラリに存在するuiを呼び出す

私のxmlファイルは次のようになります

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".DialerActivity" >

    <view 
        class="com.csipsimple.widgets.Dialpad"
        android:id="@+id/dialPad"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="center_vertical"
        android:paddingBottom="10dip"
        android:paddingLeft="5dip"
        android:paddingRight="5dip" />

</LinearLayout>

私が呼び出している私の活動

package com.*****.payphone;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

public class DialerActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dialer);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_dialer, menu);
        return true;
    }

}

同じスタックトレースは、何が間違っているのかわかりません

03-28 18:52:18.847: I/ActivityThread(16221): Pub com.csipsimple.db: com.csipsimple.db.DBProvider
03-28 18:52:18.870: D/dalvikvm(16221): GC_CONCURRENT freed 152K, 2% free 9116K/9296K, paused 8ms+6ms, total 71ms
03-28 18:52:18.894: V/DummySetUp(16206):  <sip:****@*****.net> IwYzK5IbKJv8DQT 1
03-28 18:52:18.956: D/AndroidRuntime(16206): Shutting down VM
03-28 18:52:18.956: W/dalvikvm(16206): threadid=1: thread exiting with uncaught exception (group=0x41f27930)
03-28 18:52:18.964: E/AndroidRuntime(16206): FATAL EXCEPTION: main
03-28 18:52:18.964: E/AndroidRuntime(16206): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.novanet.payphone/com.*****.payphone.DialerActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class com.csipsimple.widgets.Dialpad
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.os.Handler.dispatchMessage(Handler.java:99)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.os.Looper.loop(Looper.java:137)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.app.ActivityThread.main(ActivityThread.java:5039)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at java.lang.reflect.Method.invokeNative(Native Method)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at java.lang.reflect.Method.invoke(Method.java:511)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at dalvik.system.NativeStart.main(Native Method)
03-28 18:52:18.964: E/AndroidRuntime(16206): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class com.csipsimple.widgets.Dialpad
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.view.LayoutInflater.createView(LayoutInflater.java:613)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.app.Activity.setContentView(Activity.java:1881)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at com.novanet.payphone.DialerActivity.onCreate(DialerActivity.java:12)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.app.Activity.performCreate(Activity.java:5104)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
03-28 18:52:18.964: E/AndroidRuntime(16206):    ... 11 more
03-28 18:52:18.964: E/AndroidRuntime(16206): Caused by: java.lang.reflect.InvocationTargetException
03-28 18:52:18.964: E/AndroidRuntime(16206):    at java.lang.reflect.Constructor.constructNative(Native Method)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.view.LayoutInflater.createView(LayoutInflater.java:587)
03-28 18:52:18.964: E/AndroidRuntime(16206):    ... 22 more
03-28 18:52:18.964: E/AndroidRuntime(16206): Caused by: android.view.InflateException: Binary XML file line #31: Error inflating class android.widget.ImageButton
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.view.LayoutInflater.createView(LayoutInflater.java:613)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.view.LayoutInflater.inflate(LayoutInflater.java:459)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at com.csipsimple.widgets.Dialpad.<init>(Dialpad.java:105)
03-28 18:52:18.964: E/AndroidRuntime(16206):    ... 25 more
03-28 18:52:18.964: E/AndroidRuntime(16206): Caused by: java.lang.reflect.InvocationTargetException
03-28 18:52:18.964: E/AndroidRuntime(16206):    at java.lang.reflect.Constructor.constructNative(Native Method)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.view.LayoutInflater.createView(LayoutInflater.java:587)
03-28 18:52:18.964: E/AndroidRuntime(16206):    ... 33 more
03-28 18:52:18.964: E/AndroidRuntime(16206): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x7f01000f a=2}
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.content.res.Resources.loadDrawable(Resources.java:1927)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.view.View.<init>(View.java:3328)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.widget.ImageView.<init>(ImageView.java:114)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.widget.ImageButton.<init>(ImageButton.java:87)
03-28 18:52:18.964: E/AndroidRuntime(16206):    at android.widget.ImageButton.<init>(ImageButton.java:83)
03-28 18:52:18.964: E/AndroidRuntime(16206):    ... 36 more

私のライブラリ プロジェクトは、パッケージ com にあるメイン プロジェクトの外にあります。* .payphone と使用されているライブラリ プロジェクトは com.csipsimple.widget.Dialpad です

4

3 に答える 3

2

<com.csipsimple.widgets.Dialpad代わりに使用しようとしましたか

 <view 
        class="com.csipsimple.widgets.Dialpad"

?

于 2013-03-28T15:33:29.553 に答える
1

以下のように、カスタム ビューを XML で定義する必要があります。

<com.csipsimple.widgets.Dialpad
    android:id="@+id/dialPad"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="center_vertical"
    android:paddingBottom="10dip"
    android:paddingLeft="5dip"
    android:paddingRight="5dip" />
于 2013-03-28T15:34:29.650 に答える
0

テーマが ActionBarSherlock テーマの 1 つを拡張していることを確認してください。ダイヤルパッドのボタンは、ABS の背景を使用します。この類似の問題を参照してください。

于 2014-06-04T19:41:08.000 に答える