2016-12-23 3 views
0

Ist möglich? Ich benutze einen Bildschirm, um Ihnen zu helfen.Ist es möglich, ein Bild in zwei verschiedenen Layouts zu teilen?

Das ist meine App ohne 2 Layout:

enter image description here

End Dieses mit dem zweiten Plan ist (ich brauche diese zweite Layout aber Ich möchte das Teil des Bildes sehen, verloren): enter image description here

Das ist mein xml-Code:

<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

Ich sehe nicht das Koordinatorlayout in dem XML-Code, den Sie freigegeben haben –

+0

ja, es gibt ..

+0

Ich muss es entschuldigen. In einem RelativeLayout ist der Z-Wert (Höhe) der Elemente direkt mit der Reihenfolge verknüpft, in der Sie sie zur Ansicht hinzufügen. Versuchen Sie also, die Stellen (in der Layoutdatei) des Koordinatorlayouts und des linearen Layouts zu tauschen. –

Antwort

0

In einem RelativeLayout hängt der Z-Wert (Höhe) der Elemente direkt mit der Reihenfolge zusammen, in der Sie sie zur Ansicht hinzufügen. Und Elemente werden einer Ansicht in einer Reihenfolge von oben nach unten aus einer XML-Datei hinzugefügt.

Versuchen Sie also, die Stellen (in der Layoutdatei) des Koordinatorlayouts und des linearen Layouts zu tauschen.

Verwandte Themen