2016-04-09 17 views
0

, ben API ile cihazlarda garip gölge görüntüler bulmak> göründüğü nasıl 19.Android Destek Çubuğu gölge API> 19

Android 4.4.2 API 19 yılında:

enter image description here

enter image description here: bu API> 19 ile hiçbir şeye bakar nasıl

API 19 ile herhangi bir gölgeye sahip olmadığı ve arka planla "bütünleştiği" yerde görünmesi gerekiyor.


Bu Etkinliği bir DrawerLayout ile kullandığım için 2 düzenim var.

activity_main_tabbed.xml

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/main_tabbed_drawer_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:openDrawer="right"> 

    <include 
     layout="@layout/activity_main_tabbed_content" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 

    <android.support.design.widget.NavigationView 
     android:id="@+id/nav_view" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_gravity="right" 
     android:fitsSystemWindows="true" /> 

</android.support.v4.widget.DrawerLayout> 

activity_main_tabbed_content.xml

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:background="@drawable/activity_background_vertical" 
    android:layout_height="match_parent"> 

    <android.support.design.widget.AppBarLayout 
     android:paddingLeft="@dimen/activity_horizontal_margin" 
     android:paddingRight="@dimen/activity_horizontal_margin" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
     android:background="@android:color/transparent"> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="@dimen/action_bar_height" 
      android:elevation="0dp" 
      android:background="@android:color/transparent" 
      app:layout_scrollFlags="scroll|enterAlways"> 
      <ImageView 
       android:layout_width="wrap_content" 
       android:id="@+id/btn_toolbar_back" 
       android:src="@drawable/left_white_arrow" 
       android:visibility="gone" 
       android:layout_height="match_parent" 
       android:layout_marginRight="@dimen/btn_back_toolbar_margin_right" 
       android:minHeight="@dimen/btn_back_toolbar_height" 
       android:minWidth="@dimen/btn_back_toolbar_width" 
       android:layout_gravity="left|center_vertical"/> 
      <rokk3rlabs.dingding.utils.views.FontTextView 
       android:layout_width="wrap_content" 
       android:textSize="@dimen/toolbar_text_size" 
       android:layout_height="wrap_content" 
       android:textColor="@color/colorPrimary" 
       android:text="@string/toolbar_title" 
       android:layout_gravity="left" 
       android:id="@+id/toolbar_title" /> 

     </android.support.v7.widget.Toolbar> 

     <android.support.design.widget.TabLayout 
      android:id="@+id/tabs" 
      android:layout_width="match_parent" 
      android:layout_height="@dimen/action_bar_height" 
      app:tabMode="fixed" 
      android:elevation="0dp" 
      app:tabGravity="fill"/> 
    </android.support.design.widget.AppBarLayout> 

    <android.support.v4.view.ViewPager 
     android:id="@+id/viewpager" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 
</android.support.design.widget.CoordinatorLayout> 

styles.xml

<resources> 

    <style name="AppTheme" parent="Theme.AppCompat"> 
     <item name="windowNoTitle">true</item> 
     <item name="windowActionBar">false</item> 
     <!-- Customize your theme here. --> 
     <item name="colorPrimary">@color/colorPrimary</item> 
     <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
     <item name="colorAccent">@color/colorAccent</item> 
     <!-- <item name="android:windowBackground">@drawable/activity_background</item>--> 
     <item name="android:textColorPrimaryInverse">@color/colorPrimary</item> 
     <item name="android:textColorSecondaryInverse">@color/colorPrimary</item> 
     <item name="android:colorBackground">@color/colorPrimaryDark</item> 
     <item name="android:colorForeground">@color/colorPrimary</item> 
     <item name="android:textColorPrimary">@color/colorPrimary</item> 
     <item name="android:textColorSecondary">@color/colorPrimary</item> 
     <item name="android:windowBackground">@color/colorPrimary</item> 
    </style> 

styles.xml (V21)

<style name="AppTheme" parent="Theme.AppCompat"> 
    <!-- Customize your theme here. --> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="colorAccent">@color/colorAccent</item> 
    <item name="android:textColorPrimaryInverse">@color/colorPrimary</item> 
    <item name="android:textColorSecondaryInverse">@color/colorPrimary</item> 
    <item name="android:colorBackground">@color/colorPrimaryDark</item> 
    <item name="android:colorForeground">@color/colorPrimary</item> 
    <item name="android:textColorPrimary">@color/colorPrimary</item> 
    <item name="android:textColorSecondary">@color/colorPrimary</item> 
    <item name="android:navigationBarColor">@color/navigationBarColor</item> 
    <item name="android:statusBarColor">@color/statusBarColor</item> 
    <item name="android:windowBackground">@color/colorPrimary</item> 
    <item name="windowNoTitle">true</item> 
    <item name="windowActionBar">false</item> 
</style> 

cevap

1

AppBarLayout'un sağlam bir arka plana sahip olmasını sağlayın veya app:elevation="0dp"'u (değilandroid:elevation) ayarlayın.

Not: Neden rengin her rengini ayarlıyorsunuz? Mor arka plan üzerinde mor metin çalışmayacak. Ayrıca, appbar düzeninin nerede bittiğini ve etkinlik arka planının ekran görüntüsünde başladığını bilmek imkansız hale getirir.

+0

Yanıt için teşekkürler. “Ayrıca, appbar düzeninin nerede bittiğini ve ekranın arka planında etkinlik arka planının nerede başladığını bilmek imkansız” aslında müşterinin istediği şey! – RominaV

+0

Bu durumda yalnızca ' @ color/colorPrimary' ve hatta 'android: colorBackground' pop-up'ları için öneriyorum. Varsayılan olarak beyaz metin iyi olmalıdır. –

+0

Ayar uygulaması: AppBarLayout için elevasyon = "0dp" çalıştı. Teşekkürler! – RominaV

İlgili konular