2017-01-15 3 views
0

xmlでpptビューを作成するために外部jarファイルを使用しようとしていますが、アンドロイドスタジオにレンダリングの問題が表示されません。 https://github.com/itsrts/pptviewer-android
しかし、それは正常にコンパイルされ、正確にアンドロイドスタジオのレイアウトを表示していない私のアンドロイド携帯電話で実行する理由は何ですか?ここで 外部ライブラリからxmlを追加すると、relativelayoutの宣言が見つかりません

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 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="ahsan.islam.com.madpresentor.MainActivity" > 

<com.itsrts.pptviewer.PPTViewer 
android:id="@+id/pptviewer" 
android:layout_width="match_parent" 
android:layout_height="match_parent" /> 

</RelativeLayout> 

ここ

Error details in xml layout

は私build.gradleあるファイルここ

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 24 
buildToolsVersion "24.0.3" 
defaultConfig { 
    applicationId "ahsan.islam.com.madpresentor" 
    minSdkVersion 17 
    targetSdkVersion 24 
    versionCode 1 
    versionName "1.0" 
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 
} 

dependencies { 
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',  { 
    exclude group: 'com.android.support', module: 'support-annotations' 
}) 
compile files('libs/android-support-v4.jar') 
compile files('libs/itsrts-pptviewer.jar') 
compile fileTree(include: ['*.jar'], dir: 'libs') 
compile 'com.android.support:appcompat-v7:24.2.1' 
testCompile 'junit:junit:4.12' 
} 

である私のmenifestファイル

エラーの詳細です0
<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="ahsan.islam.com.madpresentor" 
android:versionCode="1" 
android:versionName="1.0"> 


<uses-sdk 
    android:minSdkVersion="13" 
    android:targetSdkVersion="19" /> 
<uses-permission android:maxSdkVersion="22" android:name="android.permission.READ_EXTERNAL_STORAGE"/> 
<uses-permission android:maxSdkVersion="22" android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> 

<application 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme"> 
    <activity android:name=".MainActivity"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
</application> 

</manifest> 

答えて

0

通常、カスタムビューを作成するときには、そのコンストラクタをオーバーライドして、その内部でロジックを実行する必要があります。ただし、IDEはプレビューでレイアウトをインスタンス化することはできません。

コンストラクタでロジックを呼び出す前にisInEditMode()をチェックする必要がないようにするには、このメソッドは、IDEがレイアウトをプレビューしようとしているときにのみtrueを返します。

この場合、サードパーティのライブラリで問題が発生するため、おそらく何もできません。

+0

応答@BMacedoに感謝しますが、コードを再構築してプロジェクトをコンパイルするとデバイス上で完璧に動作していますが、問題が発生してそのようなエラーが発生するレイアウトを編集したい場合は –

+0

はい、これは起こりますレイアウトプレビューでコードは、エミュレータまたは任意のデバイスで正常に動作します – BMacedo

関連する問題