2016-03-18 12 views
1

私はちょうどアプリを作りましたが、一番上に白いバーがあります。私はそのActionBarを信じていますが、色を変えるすべての試みはうまくいかないのです。どのようにそれを削除するか、またはその色を変更する上の任意のアイデア?ありがとう。 enter image description hereAndroidスタジオ - 白いバーの上に

Activity.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context=".MainActivity" > 

    <WebView 
     android:id="@+id/activity_main_webview" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"/> 

    <ProgressBar 
     android:layout_centerHorizontal="true" 
     android:layout_height="wrap_content" 
     android:layout_width="wrap_content" 
     android:layout_centerVertical="true" 
     android:layout_centerInParent="true" 
     android:id="@+id/progressBar1" 
     style="@android:style/Widget.ProgressBar.Small.Inverse" /> 

    <TextView 
     android:layout_centerHorizontal="true" 
     android:layout_height="wrap_content" 
     android:layout_width="wrap_content" 
     android:layout_centerVertical="true" 
     android:layout_centerInParent="true" 
     android:id="@+id/LoadingText" 
     android:layout_below="@+id/progressBar1" 
     android:text="@string/loading_txt" 
     android:textSize="20sp"/> 

    <android.support.design.widget.FloatingActionButton 
     android:id="@+id/fab" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_margin="16dp" 
     android:clickable="true" 
     android:src="@android:drawable/ic_menu_edit" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentRight="true" 
     app:fabSize="normal" 
     app:layout_anchorGravity="bottom|right|end" 
     app:backgroundTint="#243313" 
     app:rippleColor="#FFF" /> 

</RelativeLayout> 

のstyles.xml

<resources> 

    <!-- Base application theme. --> 
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
     <!-- Customize your theme here. --> 
     <item name="colorPrimary">@color/colorPrimary</item> 
     <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
     <item name="colorAccent">@color/colorAccent</item> 
    </style> 

    <style name="AppTheme.NoActionBar"> 
     <item name="windowActionBar">false</item> 
     <item name="windowNoTitle">true</item> 
    </style> 

    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> 

    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /> 


</resources> 

のstyles.xml(V21)

<resources>> 

    <style name="AppTheme.NoActionBar"> 
     <item name="windowActionBar">false</item> 
     <item name="windowNoTitle">true</item> 
     <item name="android:windowDrawsSystemBarBackgrounds">true</item> 
     <item name="android:statusBarColor">@android:color/transparent</item> 
    </style> 
</resources> 

LogCat:

03-18 20:16:20.495 17416-17416/org.communionchapelefca.ccsatx E/AndroidRuntime: FATAL EXCEPTION: main 
                       Process: org.communionchapelefca.ccsatx, PID: 17416 
                       java.lang.RuntimeException: Unable to start activity ComponentInfo{org.communionchapelefca.ccsatx/org.communionchapel.ccsatx.MainActivity}: android.view.InflateException: Binary XML file line #33: Binary XML file line #33: Error inflating class android.support.design.widget.FloatingActionButton 
                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416) 
                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
                        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 #33: Binary XML file line #33: Error inflating class android.support.design.widget.FloatingActionButton 
                        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 com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:393) 
                        at android.app.Activity.setContentView(Activity.java:2172) 
                        at org.communionchapel.ccsatx.MainActivity.onCreate(MainActivity.java:48) 
                        at android.app.Activity.performCreate(Activity.java:6251) 
                        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) 
                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) 
                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)  
                        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 #33: Error inflating class android.support.design.widget.FloatingActionButton 
                        at android.view.LayoutInflater.createView(LayoutInflater.java:645) 
                        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764) 
                        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
                        at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) 
                        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
                        at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
                        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)  
                        at android.view.LayoutInflater.inflate(LayoutInflater.java:374)  
                        at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:393)  
                        at android.app.Activity.setContentView(Activity.java:2172)  
                        at org.communionchapel.ccsatx.MainActivity.onCreate(MainActivity.java:48)  
                        at android.app.Activity.performCreate(Activity.java:6251)  
                        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)  
                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)  
                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)  
                        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: java.lang.reflect.InvocationTargetException 
                        at java.lang.reflect.Constructor.newInstance(Native Method) 
                        at android.view.LayoutInflater.createView(LayoutInflater.java:619) 
                        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)  
                        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)  
                        at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)  
                        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  
                        at android.view.LayoutInflater.inflate(LayoutInflater.java:515)  
                        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)  
                        at android.view.LayoutInflater.inflate(LayoutInflater.java:374)  
                        at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:393)  
                        at android.app.Activity.setContentView(Activity.java:2172)  
                        at org.communionchapel.ccsatx.MainActivity.onCreate(MainActivity.java:48)  
                        at android.app.Activity.performCreate(Activity.java:6251)  
                        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)  
                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)  
                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)  
                        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: java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the design library. 
                        at android.support.design.widget.ThemeUtils.checkAppCompatTheme(ThemeUtils.java:34) 
                        at android.support.design.widget.FloatingActionButton.<init>(FloatingActionButton.java:110) 
                        at android.support.design.widget.FloatingActionButton.<init>(FloatingActionButton.java:104) 
                        at java.lang.reflect.Constructor.newInstance(Native Method)  
                        at android.view.LayoutInflater.createView(LayoutInflater.java:619)  
                        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)  
                        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)  
                        at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)  
                        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)  
                        at android.view.LayoutInflater.inflate(LayoutInflater.java:515)  
                        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)  
                        at android.view.LayoutInflater.inflate(LayoutInflater.java:374)  
                        at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:393)  
                        at android.app.Activity.setContentView(Activity.java:2172)  
                        at org.communionchapel.ccsatx.MainActivity.onCreate(MainActivity.java:48)  
                        at android.app.Activity.performCreate(Activity.java:6251)  
                        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)  
                        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)  
                        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)  
                        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)  
+0

への活動ですか、断片? @グレッグウィリアムズ –

+0

私はちょうどその活動を見たことはありません。あなたの目録に行き、主要な活動の下でアプリのテーマを定義してください。このようなものでなければなりません。 android:theme = "@ style/NoActionBar" –

+0

これは動作しませんでしたが、それでも白いバーが上に表示されます –

答えて

3

問題は、あなたのスタイルであるV-21ファイル

<resources> 
<style name="AppTheme.NoActionBar"> 
    <item name="windowActionBar">false</item> 
    <item name="windowNoTitle">true</item> 
    <item name="android:windowDrawsSystemBarBackgrounds">true</item> 
    <item name="android:statusBarColor">@android:color/transparent</item> 
</style> 
</resources> 

変更このライン

<item name="android:statusBarColor">@android:color/transparent</item> 

変更は '@android:カラー/透明' いくつかの他の色

+0

did not work、それはアプリをクラッシュしました。私は '@android:color/primary_text_dark'と '@android:color/background_dark'の両方を試しました –

+0

#000000または何か他のヘックスは使用しません。それを解決した100% – Shreyans

+0

が動作します。ありがとう! –

関連する問題