4

に来て、私が使用しているリサイクルのビューはCardViewを表示します。ナビゲーション・ドロワのメイン・アクティビティでこれを実行しました。しかし私のカードビューはアクションバーに表示されています。アンドロイド:CardViewは、アクションバー

app_bar_main

<RelativeLayout 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" 
tools:context="kb.niranjan.tvseries.MainActivity"> 

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

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

</RelativeLayout> 

content_menu

<android.support.v7.widget.CardView android:layout_width="match_parent" 
android:layout_height="wrap_content" 
xmlns:card_view="http://schemas.android.com/apk/res-auto" 
android:id="@+id/cv" 
card_view:cardCornerRadius="4dp" 
card_view:cardElevation="5dp" 
android:layout_margin="08dp" 
xmlns:android="http://schemas.android.com/apk/res/android" 
card_view:cardBackgroundColor="#263238" 
> 

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:padding="06dp" 
    > 

    <ImageView 
     android:layout_width="41dp" 
     android:layout_height="58dp" 
     android:id="@+id/person_photo" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" 
     android:layout_marginRight="16dp" 
     /> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/person_name" 
     android:layout_toRightOf="@+id/person_photo" 
     android:layout_alignParentTop="true" 
     android:textSize="30sp" 
     /> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/person_age" 
     android:layout_toRightOf="@+id/person_photo" 
     android:layout_below="@+id/person_name" 
     /> 

</RelativeLayout> 

</android.support.v7.widget.CardView> 
私は
+0

を追加し、私はそれのための解決策を見つけました。明示的にツールバーを追加し、テーマとしてnoactionbarを使用する –

答えて

1

変更あなたのapp_bar_main

<LinearLayout 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:orientation="vertical" 
    android:layout_height="match_parent"> 

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

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

</LinearLayout> 
1

まず院生を追加アクションバー

の下に自分のカードを表示したい

デ・レイアウトID:例

については
<include android:id="@+id/card_layout layout="@layout/content_main" />" 

とツールバーでは、layout_above

<android.support.v7.widget.Toolbar 
    android:id="@+id/toolbar" 
    android:layout_width="match_parent" 
    android:layout_height="?attr/actionBarSize" 
    android:layout_above="@+id/card_layout" 
    android:background="?attr/colorPrimary"/> 
関連する問題