2016-05-20 10 views
0

私はそれをgradleに移動するまでうまく動作するアプリケーションを作成しました。Android Inflate View例外

今すぐ各カスタムビューのために、我々は、エラーの下

java.lang.RuntimeException: Unable to resume activity android.view.InflateException: 
Binary XML file line #57: Binary XML file line #57: You must supply a layout_height attribute. 
                              at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3103) 
                              at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3134) 
                              at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2481) 
                              at android.app.ActivityThread.-wrap11(ActivityThread.java) 
                              at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
                              at android.os.Handler.dispatchMessage(Handler.java:102) 
                              at android.os.Looper.loop(Looper.java:148) 
                              at android.app.ActivityThread.main(ActivityThread.java:5417) 
                              at java.lang.reflect.Method.invoke(Native Method) 
                              at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
                              at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
                             Caused by: android.view.InflateException: Binary XML file line #57: Binary XML file line #57: You must supply a layout_height attribute. 
                              at android.view.LayoutInflater.inflate(LayoutInflater.java:539) 
                              at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
                              at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
                              at android.view.View.inflate(View.java:19784) 
をはじめた

<style name="Container"> 
    <item name="android:layout_width">match_parent</item> 
    <item name="android:layout_height">wrap_content</item> 
</style> 


<style name="TextAppearance.SubTitle" > 
    <item name="android:layout_width">wrap_content</item> 
    <item name="android:layout_height">wrap_content</item> 
</style> 

以下の通りです、私はTextViewに、私はXMLで以下のように定義された

<RelativeLayout 
      android:id="@+id/text_message" 
      style="@style/Container"> 


      <co.customview.FontTextView 
       android:id= "@+id/header_message" 
       style= "@style/TextAppearance.SubTitle" 
       android:layout_marginBottom="@dimen/gap_small" 
       android:layout_width="wrap_content"/> 
     </RelativeLayout> 

スタイルを使用したカスタムを持っていました

+0

fontviewから 'android:layout_width =" wrap_content "'を削除しようとしましたか? –

+0

"レイアウト属性値を指定する必要があります"というエラーをお読みください。 ..あなたの場合、 "co.customview.FontTextView"にはlayout_height属性がありません。 –

+0

@sunilsunny彼はカスタムスタイルを使用しています。 –

答えて

0

変更

あなたは layout_height属性を指定have'nt

<co.customview.FontTextView 
         android:id= "@+id/header_message" 
         style= "@style/TextAppearance.SubTitle" 
         android:layout_marginBottom="@dimen/gap_small" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content"/> 

から

<co.customview.FontTextView 
        android:id= "@+id/header_message" 
        style= "@style/TextAppearance.SubTitle" 
        android:layout_marginBottom="@dimen/gap_small" 
        android:layout_width="wrap_content"/> 

+0

そうすることで問題が解決します。このようなファイルがたくさんあります。私は根本的な原因を見つける必要がある理由は、このような起きている – MRX

+0

すべてのビューについては、幅と高さを指定する必要があります。 –

+0

@MRX:私の解決策が働くなら、私の答えを受け入れることができます。ありがとうございます –