2016-11-02 2 views
0

좋아요, 그래서 ScrollView를 만들고 그 안에 요소가있는 두 개의 선형 레이아웃을 만들었습니다. 나는 디자인 모드로 갈 때 나는이 (왼쪽 사진)를 참조하십시오,하지만 난 내 휴대폰에 응용 프로그램을 실행할 때 나는이 (오른쪽 그림)를 얻을 :요소를 표시하지 않는 ScrollView 및 선형 레이아웃

enter image description here

바와 사진 사이의 공백 내가 제거하고 싶은 것입니다. 디자인보기가 어떻게 보이는지 보여주기 때문에 어떻게되는지 이해할 수 없습니다. 나는 또한 서랍 메뉴를 사용하고 있습니다.

,691 :

<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:background="@android:color/white" 
    android:fitsSystemWindows="true" 
    app:headerLayout="@layout/nav_header_main" 
    app:menu="@menu/activity_main_drawer" 
    /> 
내 activity_main_drawer입니다 이건 내 활동의 주요 XML :

<ScrollView 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" 
    xmlns:card_view="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/ScrollView01" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 

    <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:layout_height="wrap_content" 
     android:orientation="vertical" 
     android:weightSum="1"> 

     <ImageView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      app:srcCompat="@drawable/tvrdjava" 
      android:id="@+id/imageView8" 
      android:adjustViewBounds="true" 
      android:cropToPadding="false" /> 

     <!-- Ovde pocinju kartice (Cards) --> 
     <LinearLayout 
      android:id="@+id/activity_main" 
      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" 
      tools:context="com.example.ivanp.cardivantestdva.MainActivity" 
      android:orientation="vertical" 
      android:weightSum="1"> 

      <android.support.v7.widget.CardView 
       android:layout_width="match_parent" 
       android:layout_weight="0.85" 
       app:cardPreventCornerOverlap="false" 
       app:cardUseCompatPadding="true" 
       android:layout_marginBottom="11dp" 
       card_view:cardBackgroundColor="#607D8B" 
       android:layout_height="55dp"> 


       <!-- Naslov kartica --> 
       <LinearLayout 
        android:orientation="horizontal" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_margin="10dp" 
        > 

        <TextView 
         android:text="Tvrdjava" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:id="@+id/textView52" 
         android:layout_weight="1" 
         android:textSize="20sp" 
         android:textColor="@android:color/white" 
         /> 

        <TextView 
         android:text="test" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:id="@+id/datumprikaz" 
         android:layout_weight="1" 
         android:textSize="20sp" 
         android:textColor="@android:color/white" 
         android:gravity="right" 
         /> 

       </LinearLayout> 

       <View 
        android:id="@+id/view1" 
        android:layout_width="fill_parent" 
        android:layout_height="1dp" 
        android:layout_below="@+id/textView9" 
        android:layout_marginTop="38dp" 
        android:layout_marginLeft="10dp" 
        android:layout_marginRight="10dp" 
        android:background="@android:color/white" /> 

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

     </LinearLayout> 
    </LinearLayout> 
</ScrollView> 

업데이트 :

내 XML이다
<?xml version="1.0" encoding="utf-8"?> 

<group android:checkableBehavior="single" 
    android:id="@+id/menu_top"> 
    <item 
     android:id="@+id/nav_tvrdjava" 
     android:icon="@drawable/ic_menu_camera" 
     android:title="Tvrdjava" /> 
    <item 
     android:id="@+id/nav_bubanj" 
     android:icon="@drawable/ic_menu_gallery" 
     android:title="Bubanj" /> 
    <item 
     android:id="@+id/nav_cegar" 
     android:icon="@drawable/ic_menu_slideshow" 
     android:title="Čegar" /> 
    <item 
     android:id="@+id/nav_celekula" 
     android:icon="@drawable/ic_menu_manage" 
     android:title="Ćele kula" /> 
</group> 

<group 
    android:id="@+id/menu_bottom" 
    android:checkableBehavior="single"> 
     <item 
      android:id="@+id/nav_podesavanja" 
      android:icon="@drawable/ic_menu_share" 
      android:title="Podešavanja" /> 
     <item 
      android:id="@+id/nav_onama" 
      android:icon="@drawable/ic_menu_send" 
      android:title="O Nama" /> 
</group> 

+0

너무 당신의 DrawerLayout XML을 첨부하십시오. –

+0

android studio의 레이아웃 편집기에서 같은 해상도를 사용하고 있습니까? 레이아웃을 렌더링 할 장치를 선택할 수 있습니다. LG G3은 큰 해상도 btw 있습니다. 귀하의 문제는 adjustViewBounds 및 cropToPadding 주위에 있다고 생각합니다. 장치 해상도가 크기 때문에 이미지 뷰는 이미지의 비율을 유지하려고 시도하고 여분의 공백으로 끝납니다 – Alex

+0

다른 장치를 체크인 했습니까? 모든 시나리오에서 똑같은 것을 보여주고 있습니까? –

답변

0

그것을 고정! 이를 위해

<resources> 
<!-- Default screen margins, per the Android Design guidelines. --> 
<dimen name="nav_header_vertical_spacing">16dp</dimen> 
<dimen name="nav_header_height">160dp</dimen> 
<!-- Default screen margins, per the Android Design guidelines. --> 
<dimen name="activity_horizontal_margin">16dp</dimen> 
<dimen name="activity_vertical_margin">16dp</dimen> 
<dimen name="fab_margin">16dp</dimen> 

: 문제는 값의 기본 여백을했다/dimens.xml 그냥이 변경

<resources> 
<!-- Default screen margins, per the Android Design guidelines. --> 
<dimen name="nav_header_vertical_spacing">16dp</dimen> 
<dimen name="nav_header_height">160dp</dimen> 
<!-- Default screen margins, per the Android Design guidelines. --> 
<dimen name="activity_horizontal_margin">0dp</dimen> 
<dimen name="activity_vertical_margin">0dp</dimen> 
<dimen name="fab_margin">16dp</dimen> 

관련 문제