2017-03-09 10 views
1

私はXamarinのNewBieです。私はNuget Package ManagerからAndroid.Support.V7.App Libraryをインストールし、プロジェクトは正常に構築されました。Android.Support.V7.App.AppCompatActivity使用時にResourceNotFoundExceptionを取得する

Android.Content.Res.Resources+NotFoundException: Resource ID #0x7f030015 

マイアクティビティコードは以下の通りである: - - :私は例外を取得していますよりも、私が代わりに活性のAppCompatActivityをexteningていた場合、今

using Android.App; 
    using Android.Widget; 
    using Android.OS; 
    using Android.Content; 
    using Android.Preferences; 
    using Android.Support.V7.App; 

    namespace ExampleDemo 
    { 
[Activity(Label = "ExampleDemo", Icon = "@drawable/icon")] 
public class MainActivity : AppCompatActivity 
{ 
    protected override void OnCreate(Bundle bundle) 
    { 
     base.OnCreate(bundle); 

     // Set our view from the "main" layout resource 
     SetContentView (Resource.Layout.Main); 
    } 
} 
} 

そして、私のAXMLファイルには、このコードが含まれています: -

<?xml version="1.0" encoding="utf-8"?> 
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <Button 
    android:id="@+id/MyButton" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/Hello" 
    android:layout_marginTop="50dp" 
    android:layout_marginLeft="20dp" 
    android:layout_marginRight="20dp" /> 
    </LinearLayout> 

誰でも私が間違っていることを教えていただけますか?

ありがとうございました。

+0

例外はどこに発生しますか? (デバッグ出力をスクロールすると、さらに詳しい情報が得られます) –

+0

クリーンソリューションMy MainActivityを使用しました。しかし、私がを使用すると、別の例外が表示されます。 - Android.Views.InflateException:バイナリXMLファイル行#1:バイナリXMLファイル行#1:クラスandroid.supportを拡張しているエラーです。 design.widget.TextInputLayout @Malte – yash

答えて

0

試しましたを解決しますか? Xamarinはxmlを解析するどこかで動かなくなることがあります。

+0

これは私のMainActivityと連携しました。しかし、私は それは私に別の例外を与えるよりも: - Android.Views.InflateException:バイナリXMLファイル行#1:バイナリXMLファイル行#1:エラーinflatingクラスandroid.support .design.widget.TextInputLayout @nyconing – yash

+0

解決済み... android.suppot.designを追加する必要があります.Nuget Package Managerから外部にあり、Fine .... – yash

関連する問題