마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

텍스트가 계속 왼쪽상단에만 있는데 중간 바텀에 출력되게 하고 싶어요

0 추천

텍스트가 계속 왼쪽상단에만 있는데 중간 바텀에 출력되게 하고 싶어요

<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="850">

       <FrameLayout
           android:layout_width="fill_parent"
           android:layout_height="fill_parent">
           	 <ImageView
		     android:id="@+id/bt_state"
		     android:layout_width="match_parent"
		     android:layout_height="match_parent"
		     android:background="@drawable/bt_indicator" />
           	 <LinearLayout
           	     android:orientation="horizontal"
           	     android:layout_width="fill_parent"
           	     android:layout_height="fill_parent"
           	     android:layout_gravity="bottom|center">
           	     	 <TextView
					     android:id="@+id/bluetooth_state"
					     android:layout_width="wrap_content"
					     android:layout_height="wrap_content"
					     android:textColor="#000000"
					     android:textStyle="bold"
					     android:gravity="bottom"
					     android:background="#ffffff" />
           	 </LinearLayout>
           	     
       </FrameLayout>
       

   </LinearLayout>

 

쿠쿠부다스 (6,470 포인트) 님이 2017년 3월 3일 질문

1개의 답변

0 추천
리니어 레이아웃의 특성과 gravity 속성의 특징을 공부하셔야할것 같아요

리니어레이아웃의 orientation이 horizontal이니 왼쪽부터 쌓일거고

텍스트뷰는 gravity속성을 주어도 wrap wrap이니 왼쪽 위에 존재하겠죠

가장 간단하게 중앙 하단으로 내릴 방법은

리니어 레이아웃을 릴레이티브레이아웃으로 변경한 뒤

그래비티로 텍스트뷰의 위치를 바꿔주시면 되겠네요
초보개발자 님이 2017년 3월 3일 답변
...