2015-12-21 12 views
5

Używam Android Studio do programowania. Docelowy pakiet SDK to 23, a minimalny pakiet SDK to 15Jak mogę usunąć pasek czynności z Androidem Shadow

Próbuję usunąć cień między moim paskiem akcji a układem karty przesuwanej. Ale nie jestem w stanie.

Uwaga: cień jest widoczny tylko w systemie Android 5 i górnym.

Użyłem <item name="elevation">0dp</item> i getSupportActionBar().setElevation(0); Ale nadal to nie działa ...

enter image description here

My Style.xml

<resources> 

<!-- Base application theme. --> 
<style name="AppTheme" parent="Theme.AppCompat.Light"> 
    <!-- 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"> 
    <item name="elevation">0dp</item> 
</style> 

My Style 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> 

My MainActivity.java onCreateCode:

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 
    setSupportActionBar(toolbar); 

    getSupportActionBar().setElevation(0); 

....

Odpowiedz

9

Brakuje prefiks w swoim stylu.

<item name="android:elevation">0dp</item> 

Mimo to można również ustawić go bezpośrednio na AppBarLayout

<android.support.design.widget.AppBarLayout 
    android:layout_height="wrap_content" 
    android:layout_width="match_parent" 
    android:elevation="0dp" 
    android:theme="@style/AppTheme.AppBarOverlay"> 

czy co lubię robić się przesunąć SlidingTabLayout do AppBarLayout więc cień pojawia się pod nim:

<android.support.design.widget.AppBarLayout 
    android:layout_height="wrap_content" 
    android:layout_width="match_parent" 
    android:theme="@style/AppTheme.AppBarOverlay"> 

    <android.support.v7.widget.Toolbar android:id="@+id/toolbar" 
     android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" 
     android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" 
     /> 

    <com.ccswe.SmokingLog.views.widgets.SlidingTabLayout 
     android:id="@+id/sliding_tabs" 
     android:layout_width="wrap_content" 
     android:layout_height="@dimen/tab_layout_height" 
     /> 

</android.support.design.widget.AppBarLayout> 

Output from last code snippet

+0

Dziękuję mężczyzn Dziękuję wam loooooooooooooot przeniosłem kartę do appbar zbyt i jego stałym Dziękuję i powodzenia –

+0

You” nie ma za co. Nie zapomnij przyjąć lub udzielić odpowiedzi, jeśli rozwiąże ona Twój problem. –

+0

dziękuję to działało –

3

spróbuj dodać ustawienie elewacji na 0 przy pomocy biblioteki wsparcia

<android.support.design.widget.AppBarLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    app:elevation="0dp" 
    android:theme="@style/AppTheme.AppBarOverlay"> 
Powiązane problemy