나는 이전에이 작업을 수행했음을 확신하지만 어떻게 잊어 버렸습니다.TextView를 단추의 오른쪽으로 유지하면서 가운데에 맞 춥니 다?
여기에 문제가 있습니다. 버튼과 텍스트 뷰가 있는데 버튼이 왼쪽에있는 동안 텍스트 뷰를 중앙에 배치하고 싶습니다.
문제 없습니까? 그냥 relativelayout에 넣고 textview centerinparent, button alignparentleft를 만듭니다.
하지만 이제 동적으로 텍스트를 변경하므로 버튼 상단에 잠재적으로 작성할 수 있습니다. 텍스트 뷰에서 toRightOf = "@ id/button"을 추가합니다. 아니, 이제는 더 이상 중심에 있지 않습니다.
스크린 샷을 제공하고 싶지만 컴퓨터가 메모리가 부족하여 그렇게 할 수없는 것 같습니다.
는 여기에 몇 가지 코드입니다 :
http://pastebin.com/3N70Vjre
<RelativeLayout
android:id="@+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true">
<Button
android:id="@+id/leftbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="text!"
/>
<TextView
android:id="@+id/toptext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:layout_toRightOf="@id/leftbutton"
android:layout_centerInParent="true"
android:textSize="16sp"
android:textStyle="bold"
android:text="Text!"
android:singleLine="true"
/>
</RelativeLayout>
당신이 명확하게 할 수에서 당신을 지적하는 데 도움이?어느 것이 작동하고 어느 것이 작동하지 않습니까? – mibollma
저는 수평 중심에 대해 이야기하고 있습니다. relativelayout 내의 수직 센터링은 정상적으로 작동합니다. – AmITheRWord