2016-08-07 2 views
0

많은 것을 검색했지만 내 경우에는 아무 것도 작동하지 않는 것 같습니다. 다음은 상대 레이아웃을 사용하여 달성하고자하는 것입니다. enter image description here하나의 뷰를 xml의 다른 relativelayout에 두는 방법

아래 코드는 내 xml 코드입니다. 이 마이크를 수행함으로써

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

은 다음-이전 스트립 뒤에 숨겨져 있습니다. z 축에서 뷰 높이를 제어하는 ​​매개 변수가 있다고 생각하지만 기억하지 못하고 Lolipop 아래에서도 작동합니다. 도와주세요.

+0

좋아, 나는'android : elevation = "10dp"'가 z 축을 증가시킴으로써 앞쪽으로보기를 가져 오는 것을 발견했다. 하지만 Lolipop 아래에서 작동합니까? –

+0

'아무것도 작동하지 않는 것 같습니다. '... 아마 [** FloatingActionButton **] (https://developer.android.com/reference/android/support/design/widget/FloatingActionButton.html)가됩니다. –

+1

버튼 정의를 레이아웃의 끝으로 옮기면됩니다. – tynn

답변

2

당신이 당신의 "마이크 레이아웃은"당신이 당신의 현재 레이아웃으로 많은 것을 할 필요가 없습니다 표시 할 경우 (XML)

그냥 이전 및 다음 "후"마이크 상대 레이아웃 "를 넣어 이 당신을 도움이되기를 바랍니다

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

아래와 같이 상대 레이아웃
".

+0

고마워요. 나는 그것이 쉽지 않을 것이라는 것을 몰랐다. –

+0

환영 인사 ... –

관련 문제