2017-02-15 3 views
0

내 AppBar에서 이상한 일을합니다. 이것은 720x1280 화면에서 보이는 것입니다. enter image description hereAppBar 높이가 잘못되었습니다.

어떻게 보일까요? 그리고 이것은 1080x1920 화면에서 보이는 모습입니다. enter image description here app_bar_main.xml에서 툴바 높이로 놀고 있었지만 마음에 들지 않았습니다. 그래서 다시 기본값 인 attr/actionBarSize 값으로 설정했습니다. . 무엇이 문제 일 수 있습니까? 여기

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout 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="com.koostamas.justtry.MainActivity"> 

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

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

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

그리고 내 activity_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:layout_height="match_parent" 
android:orientation="vertical" > 

<include 
    android:id="@+id/app_bar" 
    layout="@layout/app_bar_main" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" /> 
<android.support.v4.widget.DrawerLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/drawerLayout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <FrameLayout 
     android:orientation="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/containerView"> 
    </FrameLayout> 


    <RelativeLayout 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:id="@+id/drawerPane" 
     android:layout_gravity="start"> 

     <!-- List of Actions (pages) --> 
     <ListView 
      android:id="@+id/navList" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:choiceMode="singleChoice" 
      android:background="@color/busblue"/> 

    </RelativeLayout> 

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

</LinearLayout> 
+0

activity_main.xml 코드에서 높이와 너비 속성을 제거하려면이

<?xml version="1.0" encoding="utf-8"?> <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" /> 

업데이트의

갱신 app_bar_main.xml ocde은 레이아웃 코드 높이를 해결 –

+0

을 포함하지만, 그러면 탐색 표시 줄과 appbar 아래의 단편이 사라지고 흰색 배경 만 보입니다. –

답변

1

하는 코드를 업데이트하려고 여기 내 app_bar_main.xml입니다. 내게있어이 문제는 당신의 견해와 관련이 있습니다. 귀하의 접근 방식은 이것을 추가하는 것이 적절하지 않습니다. 툴바 만 포함하면 coordinateLayoutAppBarLayout의 필요성이 무엇입니까! 이

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/drawerLayout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <include 
     android:id="@+id/app_bar" 
     layout="@layout/app_bar_main" /> 

    <FrameLayout 
     android:id="@+id/containerView" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"></FrameLayout> 

    <RelativeLayout 
     android:id="@+id/drawerPane" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_gravity="start"> 

     <!-- List of Actions (pages) --> 
     <ListView 
      android:id="@+id/navList" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:background="@color/busblue" 
      android:choiceMode="singleChoice" /> 

    </RelativeLayout> 

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

+0

appbar가 그 아래 조각 아래에 있다고 말했듯이 내가 포함하면, drawerlayout (내 appbar 아래에서 탐색 서랍이 시작되기를 바란다)에서 include를 움직이면 이전과 똑같이 보입니다. –

+0

ok 나는 하나 더 xml을 업데이트 할 것이고, xml의 위의 이들을 제외하고 하나만한다고 단정 짓는다. –

+0

알았다. 당신이 올린 xml은 옳지 않았지만, 당신은 코디네이터 레이아웃이 필요 없다고 썼고 당신은 옳았습니다. 그것으로 해결되었습니다. 감사. 게시물을 업데이트하십시오. 다른 사람이 답을 필요로한다면 명확 할 것입니다. –