2016-12-22 5 views
0

У меня есть небольшая проблема с моей андроид дизайн кода, данных перекрывает панель инструментов:Android - Данные в/внутри панели

Я просто использую панель навигации с REST API результат адаптера данных. Данные представлены row.xml:

row.xml

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:orientation="vertical" 
    android:clickable="false" 
    android:descendantFocusability="blocksDescendants" 
    android:focusable="false" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    android:focusableInTouchMode="false" 
    android:padding="4dp"> 

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

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

      <TextView 
       android:id="@+id/tvMessage" 
       app:layout_behavior="@string/appbar_scrolling_view_behavior" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="THIS IS DATA MESSAGE" 
       android:textAppearance="?android:attr/textAppearanceSmall" /> 

     </RelativeLayout> 
    </RelativeLayout> 
</RelativeLayout> 

activity_main.xml

<?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:openDrawer="start" 
    android:clickable="false" 
    android:visibility="visible"> 


    <include 
     layout="@layout/app_bar_main" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 

    <android.support.design.widget.NavigationView 
     android:id="@+id/nav_view" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_gravity="start" 
     android:fitsSystemWindows="true" 
     app:headerLayout="@layout/nav_header_main" 
     app:menu="@menu/activity_main_drawer" /> 

    <ListView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/lvMovies" /> 


</android.support.v4.widget.DrawerLayout> 

app_bar_main.xml

<?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:openDrawer="start" 
    android:clickable="false" 
    android:visibility="visible"> 

    <include 
     layout="@layout/app_bar_main" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 

    <android.support.design.widget.NavigationView 
     android:id="@+id/nav_view" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_gravity="start" 
     android:fitsSystemWindows="true" 
     app:headerLayout="@layout/nav_header_main" 
     app:menu="@menu/activity_main_drawer" /> 


    <ListView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/lvMovies" /> 
</android.support.v4.widget.DrawerLayout> 

content_main.xml

<?xml version="1.0" encoding="utf-8"?> 
<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" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:context="com.testapp.testapp.MainActivity" 
    tools:showIn="@layout/app_bar_main"> 

    <android.support.v4.view.ViewPager 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 
</RelativeLayout> 

nav_header_main.xml

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:background="@drawable/side_nav_bar" 
    android:gravity="bottom" 
    android:orientation="vertical" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 

    android:layout_marginTop="70dp" 
    android:layout_height="0dp" 
    android:layout_weight="1" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark"> 

    <ImageView 
     android:id="@+id/imageView" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:paddingTop="@dimen/nav_header_vertical_spacing" 
     android:src="@android:drawable/sym_def_app_icon" /> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:paddingTop="@dimen/nav_header_vertical_spacing" 
     android:text="Android Studio" 
     android:textAppearance="@style/TextAppearance.AppCompat.Body1" /> 

    <TextView 
     android:id="@+id/textView" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="[email protected]" /> 
</LinearLayout> 

ответ

2

Вы кладете ListView в неправильном position.You должен поставить его в content_main.

+0

спасибо. Merry Chrstimas;) – medskill

+1

с новым годом! :) – Leito

 Смежные вопросы

  • Нет связанных вопросов^_^