2016-08-13 2 views
1

고도를 사용하여 선형 입체에 그림자 효과를 추가하고 싶습니다. 그림자가 나타나지 않는, 내 전화에를 실행하면안드로이드 - 입체 면도기

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:id="@+id/searchFragment"> 

    <RelativeLayout 
     android:id="@+id/RelativeLayout02" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:background="#ffffff"> 
      <RelativeLayout 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       xmlns:android="http://schemas.android.com/apk/res/android" 
       android:orientation="horizontal" 
       android:clipToPadding="false" 
       android:paddingBottom="5dp"> 

       <LinearLayout 
        android:orientation="horizontal" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:id="@+id/linearLayout" 
        android:paddingBottom="5dp" 
        android:elevation="8dp"> ---> here should be elevation 

        <LinearLayout 
         android:orientation="vertical" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:paddingBottom="5dp" 
         android:layout_marginRight="55dp"> 

         <AutoCompleteTextView 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:id="@+id/fromStationField" 
          android:completionThreshold="1" 
          android:hint="From" 
          android:textAlignment="textStart" 
          android:gravity="left|start" 
          android:layout_gravity="left" /> 

         <AutoCompleteTextView 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:id="@+id/toStationField" 
          android:completionThreshold="1" 
          android:hint="To" 
          android:background="@android:color/transparent" 
          android:paddingRight="4dp" 
          android:paddingLeft="4dp" /> 
        </LinearLayout> 

        <ImageView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:id="@+id/swapButton" 
         android:src="@drawable/ic_swap" 
         android:layout_gravity="center_vertical" 
         android:layout_marginLeft="-55dp"/> 
       </LinearLayout> 

       <android.support.design.widget.CoordinatorLayout 
        android:id="@+id/main_content" 
        xmlns:android="http://schemas.android.com/apk/res/android" 
        xmlns:app="http://schemas.android.com/apk/res-auto" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_below="@+id/linearLayout"> 

       <android.support.v7.widget.RecyclerView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:id="@+id/scheduleListRecyclerView" 
        android:layout_centerHorizontal="true" 
        android:layout_marginLeft="10dp" 
        android:layout_marginRight="10dp" /> 

       <android.support.design.widget.FloatingActionButton 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="bottom|right" 
        android:layout_margin="16dp" 
        app:layout_anchor="@id/scheduleListRecyclerView" 
        app:layout_anchorGravity="bottom|right|end" 
        app:layout_behavior="com.standart.trainschedule.FABScrollBehavior" 
        android:src="@drawable/abc_btn_rating_star_on_mtrl_alpha" 
        android:visibility="gone" 
        android:id="@+id/fab" /> 

       </android.support.design.widget.CoordinatorLayout> 
      </RelativeLayout> 
    </RelativeLayout> 
</LinearLayout> 

문제가 있지만 안드로이드 스튜디오에서 미리보기 모드에서 그림자가 올바르게 표시 : 여기 내 XML 코드입니다. 그것을 고치는 방법?

답변

1

표고를 원하는 선형 레이아웃의 부모 인 상대 레이아웃에서 android:clipToPadding="false"android:paddingbottom="5dp" 두 속성을 설정합니다. 선형 레이아웃을 변경하지 마십시오.

+0

정확히 어디에 설정해야합니까? – gigs

+0

첫 번째 선형 레이아웃 바로 위에 레이아웃을 설정합니다. 그렇지 않을 경우 가장 먼저 나타나는 선형 레이아웃으로 설정하십시오. – Moulesh

+0

작동하지 않습니다.하지만 모든 레이아웃에 설정합니다. 도움이되지 않습니다. – gigs