2016-12-21 2 views
0

이 문제를 어떻게 해결할 수 있습니까? 다음 화면은 다음과 같습니다 image1이 텍스트 필드와 appbar가 겹치는 이유는 무엇입니까?

이 내 XML 조각입니다 :

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context=".Utenti.Profilo.ProfiloFragment"> 


<TextView 
    android:text="IL TUO PROFILO" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/textView3" 
    android:textStyle="normal|bold" 
    android:textSize="24sp" 
    android:layout_weight="1" 

    android:fontFamily="serif" 
    android:lineSpacingExtra="10sp" 
    android:textAllCaps="false" 
    android:gravity="center_horizontal" 
    android:layout_alignParentEnd="true" 
    android:layout_alignParentStart="true" /> 

<TextView 
    android:text="Le tue stanze:" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/textView3" 
    android:layout_alignParentStart="true" 
    android:layout_marginStart="14dp" 
    android:layout_marginTop="28dp" 
    android:id="@+id/tue_stanze" 
    android:textStyle="normal|italic" 
    android:textSize="18sp" /> 

<ListView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_below="@+id/tue_stanze" 
    android:layout_centerHorizontal="true" 
    android:layout_marginTop="19dp" /> 

내가 처음으로 탐색 창을 사용하고 난 메뉴에 사용할 조각을 만들어야합니다.

도움을 청합니다.

편집 :

<?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.bfco.bocci.androhouse.MainActivity" 
tools:showIn="@layout/app_bar_main"> 

EDIT2 : 이 내 content_main의 XML입니다

<?xml version="1.0" encoding="utf-8"?> 

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

<include layout="@layout/content_main" /> 

<android.support.design.widget.FloatingActionButton 
    android:id="@+id/fab" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="bottom|end" 
    android:layout_margin="@dimen/fab_margin" 
    android:src="@android:drawable/ic_dialog_email" /> 
: 나는 content_main 포함이 "app_bar_main.xml"를 사용

그리고 이것은 내 main.xml에 있습니다 :

<?xml version="1.0" encoding="utf-8"?> 

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


<FrameLayout 
    android:id="@+id/frame_container" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    > 
</FrameLayout> 

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

+0

기본 레이아웃 xml 코드를 붙여 넣을 수 있습니까? 탐색 서랍과 컨테이너가 포함 된 레이아웃? –

+0

'getSupportActionBar(). setDisplayShowTitleEnabled (false);'그러면 흰색 제목이 앱 이름이 사라집니다. –

+0

기본 레이아웃 xml의 조각 컨테이너 안에 'app : layout_behavior = "@ string/appbar_scrolling_view_behavior">이 속성을 추가하십시오. 이게 당신의 문제를 해결할 것입니다 – saeed

답변

1

그것은 함께 조금 정확히 용기 당신의 단편에 포함하기로 불분명하지만, 어딘가에 이 속성을 포함해야합니다.

android:paddingTop="?attr/actionBarSize" 

또는 적절한 용기에

android:layout_marginTop="?attr/actionBarSize" 

.

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingTop="?attr/actionBarSize" 
    tools:context=".Utenti.Profilo.ProfiloFragment"> 

가 이상적으로 더 높은 수준에서 처리 할 것입니다,하지만 예를 들어이 해야 충분할 : 내가 위에서 보는 것을 바탕으로, 당신은 단순히 위의 게시하여 조각의 루트에 추가 할 수 있습니다.