2011-01-30 5 views
2

만 버튼이 표시,하지만 난버튼 위에 텍스트를 표시하려면 어떻게해야합니까?

<RelativeLayout 
    android:id="@+id/big_button_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:visibility="gone"> 
    <ImageButton 
    android:id="@+id/big_button" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:src="@drawable/girrafffe"/> 
    <TextView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:gravity="center_horizontal" 
    android:text="Hello" 
    android:layout_above="@id/big_button"/> 
</RelativeLayout> 

답변

6
<Button 
    android:id="@+id/button_send" 
    android:layout_width="150px" 
    android:layout_height="wrap_content" 
    android:padding="20dp" 
    android:drawableBottom="@drawable/image" 
    android:background="@android:color/transparent" 
    android:text="@string/send" 
    android:gravity="center" 
    android:layout_gravity="center" 
/> 

android:drawableBottom="@drawable/image" 따라서 텍스트를 상단에 배치 될 수 있도록 하단에있는 버튼의 이미지를 배치한다.

0

TextView.

<RelativeLayout 
    android:id="@+id/big_button_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:visibility="gone"> 
    <TextView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:gravity="center_horizontal" 
    android:text="Big Button"/> 
    <ImageButton 
    android:id="@+id/big_button" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:src="@drawable/girrafffe"/> 
    <TextView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:gravity="center_horizontal" 
    android:layout_above="@id/big_button"/> 
</RelativeLayout> 

당신은 모든 것을 줄을 몇 가지 레이아웃을 추가해야 할 수 있습니다 사용하여 버튼 위에 텍스트를보고 싶어요. 그러나이 기능이 없으면이 기능이 작동 할 수 있습니다.

+0

나는 ... 너 무슨 소리 야? – hunterp

+1

글쎄, 당신의 게시물이 여러 번 바뀌었을 것입니다, 그래서 아마 그가 대답 한 순간에 당신의 코드를 보지 못했습니다 ... –

+0

맞습니다, 당신은 내가 게시 한 후에 귀하의 게시물을 변경했습니다. 자세한 내용을 제공 한 이후로 세부 사항을 업데이트했습니다. – prolink007

관련 문제