2017-05-25 10 views
0

私は、アプリケーションバーの代わりにムービータイトルをつぶすツールバーを作ろうとしています。アプリバーの代わりに折りたたまれたツールバーのみが表示されるはずです。代わりに、それは活動のためのXMLレイアウトである。ここ this. 次のようになります。appbarがツールバーを折りたたんで表示されています

<android.support.design.widget.CoordinatorLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:card_view="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/fl_movie_info" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true"> 
    <android.support.design.widget.AppBarLayout 
     android:id="@+id/appBar" 
     android:layout_width="match_parent" 
     android:layout_height="300dp" 
     android:theme="@style/Theme.AppCompat.Light.DarkActionBar" 
     android:fitsSystemWindows="true"> 

     <android.support.design.widget.CollapsingToolbarLayout 
      android:id="@+id/info_title" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      app:layout_scrollFlags="scroll|exitUntilCollapsed" 
      app:contentScrim="?attr/colorPrimary" 
      app:expandedTitleMarginStart="48dp" 
      app:expandedTitleMarginEnd="64dp" 
      android:fitsSystemWindows="true"> 


      <ImageView 
       android:id="@+id/toolbarImage" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:scaleType="centerCrop" 
       android:fitsSystemWindows="true" 
       app:layout_collapseMode="parallax" /> 

      <android.support.v7.widget.Toolbar 
       android:id="@+id/toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="?attr/actionBarSize" 
       app:popupTheme="@style/ThemeOverlay.AppCompat.Light" 
       app:layout_collapseMode="pin" > 
      </android.support.v7.widget.Toolbar> 
     </android.support.design.widget.CollapsingToolbarLayout> 
    </android.support.design.widget.AppBarLayout> 

    <android.support.v4.widget.NestedScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical" 
      android:paddingTop="24dp"> 

      <android.support.v7.widget.CardView 
       android:id="@+id/cardView1" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_margin="5dp" 
       card_view:cardBackgroundColor="@color/colorCardView"> 
       <RelativeLayout 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content"> 
        <ImageView 
         android:id="@+id/iv_info_poster" 
         android:layout_width="150dp" 
         android:layout_height="wrap_content" 
         android:adjustViewBounds="true" 
         android:paddingTop="10dp" 
         android:paddingLeft="10dp" 
         android:paddingBottom="5dp" /> 

        <android.support.v7.widget.AppCompatRatingBar 
         android:id="@+id/rb_info_rating" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         style="?android:attr/ratingBarStyleSmall" 
         android:layout_below="@id/iv_info_poster" 
         android:numStars="5" 
         android:layout_marginLeft="10dp" /> 
        <TextView 
         android:id="@+id/tv_info_release_date" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_below="@id/rb_info_rating" 
         android:paddingBottom="5dp" 
         android:textColor="@android:color/white" 
         android:layout_marginLeft="10dp" /> 
        <TextView 
         android:id="@+id/tv_info_synopsis_title" 
         android:text="@string/synopsis" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_toRightOf="@id/iv_info_poster" 
         android:paddingLeft="25dp" 
         /> 
        <TextView 
         android:id="@+id/tv_info_synopsis" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:textColor="@android:color/white" 
         android:layout_toRightOf="@id/iv_info_poster" 
         android:layout_below="@+id/tv_info_synopsis_title" 
         android:paddingLeft="25dp" 
         android:paddingRight="25dp" /> 

       </RelativeLayout> 
      </android.support.v7.widget.CardView> 

      <android.support.v7.widget.CardView 
       android:id="@+id/cardView2" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_margin="10dp" 
       card_view:cardBackgroundColor="@color/colorCardView"> 
       <RelativeLayout 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content"> 


       </RelativeLayout> 
      </android.support.v7.widget.CardView> 

     </LinearLayout> 
    </android.support.v4.widget.NestedScrollView> 

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

AndroidManifest:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.bucki_000.popularmoviesapp"> 
    <uses-permission android:name="android.permission.INTERNET"/> 
    <uses-permission 
android:name="android.permission.ACCESS_NETWORK_STATE"/> 

    <application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:supportsRtl="true" 
     android:theme="@style/AppTheme"> 
     <activity android:name=".MainActivity" 
      android:label="@string/app_name"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
     <activity android:name=".MovieInfo"></activity> 
    </application> 

</manifest> 

答えて

0

テーマが問題である可能性があります。 ThemeはAndroidManifestであなたの活動に設定されています。

<application 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme"  <----- Theme 

AppThemeはres/valuesのstyles.xmlにあります。 "windowActionBar"と "windowNoTitle"をfalseに設定して、デフォルトのActionBarを削除してみてください。

style name="YourThemeName" parent="Theme.AppCompat.Light.DarkActionBar"> 
     <item name="windowActionBar">false</item> 
     <item name="windowNoTitle">true</item> 
     ... 
     ... 
+0

ありがとうございました – buckithed

関連する問題