2016-08-07 4 views
0

Ich suchte viel, aber nichts scheint in meinem Fall zu arbeiten. Hier ist, was ich mit relativem Layout erreichen möchte. enter image description hereWie man eine Ansicht über eine andere relative Layout in xml

unten ist mein XML-Code dafür.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

<RelativeLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_centerHorizontal="true" 
    android:focusable="true"> 

    <ImageView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/microphone" /> 
</RelativeLayout> 

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:background="@color/white" 
    android:padding="@dimen/padding_16"> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:drawableRight="@drawable/arrow" 
     android:text="@string/next" 
     android:textAllCaps="true" /> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:drawableLeft="@drawable/arrow" 
     android:text="@string/previous" 
     android:textAllCaps="true" /> 
</RelativeLayout> 

diese das Mikrofon Dadurch wird hinter dem Next-Zurück-Streifen versteckt. Ich denke, es gibt einige Parameter, um die Ansichtshöhe in der Z-Achse zu steuern, aber ich erinnere mich nicht daran, und wird es auch unter Lolipop funktionieren. Bitte helfen Sie.

+0

Okay, ich habe festgestellt, dass 'android: elevation =" 10dp "' die Sicht nach vorne durch Erhöhung der Z-Achse bringt. Aber wird es unter Lolipop funktionieren? –

+0

'nichts scheint zu funktionieren '... Wahrscheinlich ein [** FloatingActionButton **] (https://developer.android.com/reference/android/support/design/widget/FloatingActionButton.html) wird. –

+1

Verschieben Sie einfach die Schaltfläche Definition an das Ende Ihres Layouts. – tynn

Antwort

2

Wenn Sie Ihr „Mikrofon Layout“ zu zeigen, Sie müssen nicht viel zu tun, mit Ihrem aktuellen Layout (xml)

Setzen Sie einfach Ihr „Mikrofon Relative Layout-“ nach "Zurück- Relative Layout-“, wie unten

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:background="@color/white" 
     android:padding="@dimen/padding_16"> 

     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true" 
      android:drawableRight="@drawable/arrow" 
      android:text="@string/next" 
      android:textAllCaps="true"/> 

     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:drawableLeft="@drawable/arrow" 
      android:text="@string/previous" 
      android:textAllCaps="true"/> 
    </RelativeLayout> 

    <RelativeLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_centerHorizontal="true" 
     android:focusable="true"> 

     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/microphone"/> 

    </RelativeLayout> 

</RelativeLayout> 

Hoffnung, dies hilft Ihnen.

+0

Danke Mann. Ich wusste nicht, dass es so einfach wäre. –

+0

Ihre herzlichst Liebe ... –

Verwandte Themen