2016-04-29 11 views
0

ActionBarの拡張機能のように感じるために、ビュー(LinearLayout)を取得しようとしています。私はAppCompatオブジェクトbtwを使用しています。同じActionBarの高さのAndroidビュー

これは私のxmlです:

<android.support.design.widget.CoordinatorLayoutt 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:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:context=".RegisterActivity"> 

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

     <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" /> 

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

    <include layout="@layout/content_register" /> 

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

そして今content_registerレイアウト:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@color/colorPrimary" 
     android:elevation="4dp" 
     android:orientation="vertical"> 

     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:padding="8dp" 
      android:text="text1" 
      android:textColor="@color/white" /> 

     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:padding="8dp" 
      android:text="text2" 
      android:textColor="@color/white" /> 

     <View 
      android:layout_width="match_parent" 
      android:layout_height="1dp" 
      android:background="#40FFFFFF" /> 

     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:padding="8dp" 
      android:text="text3" 
      android:textColor="@color/white" /> 

    </LinearLayout> 


    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:gravity="center" 
     android:padding="8dp" 
     android:text="insert awesome stuff here" /> 

</LinearLayout> 

私は、次の画像で表現して行うには何をしようとしています: Pretended results

そして、これ私が得ているものです。 Results so far

どのように私はこのレイアウトを修正することができますか?間違ったコンポーネントを使用していますか?

また、Text1 2 3のレイアウトでCardViewを使用する必要がありますか?

答えて

1

は機能していない、あなたのAppBarLayoutに

app:elevation="0dp" 
+0

をこの行を追加します(事前ロリポップデバイス用)スタイルで

<item name="android:windowContentOverlay">@null</item> 

をこれを追加します。それでも同じ効果があります。 – HelderMPinhal

+0

どのバージョンでテストしましたか? –

+0

私はそれをAppBarLayoutに配置しなければなりませんでした。それはそこで働いた。 – HelderMPinhal

関連する問題