2016-12-23 2 views
0

Возможно? Я использую экран, чтобы помочь вам понять.Возможно ли разделение изображения в двух разных макетах?

Это мое приложение без 2 макета:

enter image description here

End Это со вторым Layout (я нужен этот второй макет, но я хочу видеть часть изображения утрачена): enter image description here

Это мой 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" 
android:paddingTop="?attr/actionBarSize" 
tools:context=".Utenti.Profilo.ProfiloFragment"> 

<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:id="@+id/linearLayout2" 
    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:theme="@style/ThemeOverlay.AppCompat.Dark" 
    android:weightSum="1" 
    android:layout_height="110dp"> 

</LinearLayout> 

<ImageView 
    android:id="@+id/imgProfilo" 
    android:layout_width="75dp" 
    android:layout_height="wrap_content" 
    android:paddingTop="@dimen/nav_header_vertical_spacing" 
    android:src="@android:drawable/sym_def_app_icon" 
    android:adjustViewBounds="false" 
    android:baselineAlignBottom="false" 
    android:layout_gravity="center" 
    android:layout_centerHorizontal="true" /> 

<TextView 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:paddingTop="@dimen/nav_header_vertical_spacing" 
    android:text="AndroHouse" 
    android:layout_gravity="center" 
    android:textAppearance="@style/TextAppearance.AppCompat.Body1" 
    android:id="@+id/nome_utente" 
    android:textAlignment="center" 
    android:layout_alignParentTop="true" 
    android:layout_alignParentEnd="true" 
    android:textSize="18sp" 
    android:textStyle="normal|bold" /> 

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_below="@+id/linearLayout2"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 


     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:background="?attr/colorPrimary" 
      app:layout_scrollFlags="scroll|enterAlways" 
      app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> 

     <ImageView 
      android:id="@+id/myImageView" 
      android:layout_height="match_parent" 
      android:layout_width="match_parent" 
      android:scaleType="centerCrop" /> 

     <android.support.design.widget.TabLayout 
      android:id="@+id/tabs" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      app:tabMode="fixed" 
      app:tabGravity="fill"/> 
    </android.support.design.widget.AppBarLayout> 

    <android.support.v4.view.ViewPager 
     android:id="@+id/viewpager" 
     android:layout_width="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" 
     android:layout_height="match_parent" /> 
</android.support.design.widget.CoordinatorLayout> 

+0

Я не вижу схему координатора в коде xml, который вы поделили –

+0

да есть ..

+0

Должно быть, пропустили это извините. Ок в RelativeLayout, z-значение (высота) элементов напрямую связано с порядком добавления их в представление. Поэтому просто попробуйте поменять местами (в файле макета) макета координатора и линейного макета. –

ответ

0

В RelativeLayout значение z (высота) элементов напрямую связано с порядком добавления их в представление. И элементы добавляются в представление в порядке сверху вниз из файла xml.

Так что просто попробуйте поменять местами (в файле макета) макета координатора и линейного макета.

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