2017-01-06 7 views
0

レイアウトコードを読み込もうとしていますが、なぜ取得できませんでした。 私はdrawerlayout用のコードを持っていますが、問題は全体のdrawerLayoutです。スクロールできるのはアイテムリストビューのスクロールがヘッダーできないため、すべてのコンポーネントがカスタムメイドであるように見えるためです。事前に いずれかがそれを見て持つことができます。.. おかげDrawerLayout全体がスクロール可能です

<?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/drawer_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:context="com.activities.MainActivity"> 

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

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

      <RelativeLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:layout_marginRight="@dimen/abc_action_bar_default_height_material"> 

       <ImageView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_centerInParent="true" 

        android:adjustViewBounds="true" 
        android:scaleType="centerInside" 
        android:src="@drawable/menu_logo" /> 

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

     <ViewFlipper 
      android:id="@+id/loading_switcher" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 

      <ProgressBar 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center" /> 

      <RelativeLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent"> 

       <android.support.design.widget.CoordinatorLayout 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_above="@+id/checkout_container"> 

        <android.support.design.widget.AppBarLayout 
         android:id="@+id/app_bar_layout" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
         app:elevation="2dp"> 

         <LinearLayout 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:background="@android:color/white" 
          android:orientation="vertical" 
          android:padding="10dp" 
          app:layout_scrollFlags="scroll|enterAlways"> 

          <com.views.font.CustomFontTextView 
           android:id="@+id/location_text_view" 
           android:layout_width="match_parent" 
           android:layout_height="wrap_content" 
           android:drawableLeft="@drawable/ic_location_on_black_18dp" 
           android:ellipsize="end" 
           android:gravity="center_vertical" 
           android:maxLines="1" 
           android:singleLine="true" 
           android:text="Pick Location" 
           android:textColor="@color/colorPrimary" 
           android:textSize="15sp" /> 

          <com.views.font.CustomFontTextView 
           android:id="@+id/locality_info_text_view" 
           android:layout_width="match_parent" 
           android:layout_height="wrap_content" 
           android:ellipsize="end" 
           android:gravity="center_vertical" 
           android:maxLines="1" 
           android:singleLine="true" 
           android:textColor="@android:color/black" 
           android:textSize="12sp" /> 
         </LinearLayout> 
        </android.support.design.widget.AppBarLayout> 

        <RelativeLayout 
         android:layout_width="match_parent" 
         android:layout_height="match_parent"           app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

         <android.support.v4.widget.SwipeRefreshLayout 
          android:id="@+id/product_list_swipe_layout" 
          android:layout_width="match_parent" 
          android:layout_height="match_parent" 
          android:layout_marginLeft="2dp" 
          android:layout_marginRight="2dp"> 

          <android.support.v7.widget.RecyclerView 
           android:id="@+id/products_list_recycler_view" 
           android:layout_width="match_parent" 
           android:layout_height="match_parent" /> 
         </android.support.v4.widget.SwipeRefreshLayout> 

        </RelativeLayout> 

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

       <com.views.CheckoutShelfView 
        android:id="@+id/checkout_container" 
        android:layout_width="match_parent" 
        android:layout_height="?attr/actionBarSize" 
        android:layout_alignParentBottom="true" /> 
      </RelativeLayout> 

      <LinearLayout 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center" 
       android:gravity="center" 
       android:orientation="vertical"> 

       <com.views.font.CustomFontTextView 
        android:id="@+id/error_text" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_margin="16dp" 
        android:gravity="center" 
        android:textColor="@color/grey_bg" 
        android:textSize="20sp" /> 

       <com.views.font.CustomFontTextView 
        android:id="@+id/error_button" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="20dp" 
        android:background="@drawable/shape_green_fill_round_5dp" 
        android:drawablePadding="2dp" 
        android:gravity="center_vertical" 
        android:paddingBottom="5dp" 
        android:paddingLeft="4dp" 
        android:paddingRight="8dp" 
        android:paddingTop="5dp" 
        android:textAllCaps="false" 
        android:textColor="@android:color/white" /> 
      </LinearLayout> 
     </ViewFlipper> 

    </LinearLayout> 
    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

    <android.support.design.widget.NavigationView 
     android:id="@+id/navigation_view" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_gravity="start" 
     app:headerLayout="@layout/header_navigation" 
     app:itemIconTint="@color/colorPrimary" 
     app:itemTextColor="@color/colorPrimary" 
     app:menu="@menu/navigation_menu"> 

     <com.views.font.CustomFontTextView 
      android:id="@+id/version_text" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_horizontal|bottom" 
      android:background="@android:color/white" 
      android:gravity="center" 
      android:padding="3dp" 
      android:textSize="10sp"> 
      </com.views.font.CustomFontTextView> 


    </android.support.design.widget.NavigationView> 
    </ScrollView> 
</android.support.v4.widget.DrawerLayout> 

答えて

0

これを試してみてください。

<android.support.design.widget.NavigationView 
android:id="@+id/navigation_view" 
android:layout_width="wrap_content" 
android:layout_height="match_parent" 
android:layout_gravity="start" 
android:fitsSystemWindows="true" 
app:headerLayout="@layout/header_navigation" 
app:itemIconTint="@color/colorPrimary" 
app:itemTextColor="@color/colorPrimary" 
app:menu="@menu/navigation_menu" /> 

で:これを試してみてください

レイアウトからScrollviewを削除しますアクティビティ;

//mNavigationView is your navigation view 
mNavViewHeaderLayout = LayoutInflater.from(MainActivity.this).inflate(R.layout.header_navigation, mNavigationView); 

//to access content in header view 
mTextview = (TextView)mNavViewHeaderLayout.findViewById(R.id.textview); 
+0

まだ同じ結果が出ていません。 –

+0

引き出しレイアウトまたはナビゲーションレイアウトには、デフォルトのスクロールビューがありますか? –

+0

@techofficeはいナビゲーションビューのコンテンツはデフォルトのスクロール可能です。 – rafsanahmad007

関連する問題