내 게임 화면에 점수, 레벨 등의 레이블을 붙이기 위해 textview 객체를 사용하고 있지만 원하는 위치에 표시되지 않는 것 같습니다. 뷰 계층 구조 (부모, 자식)에 대해 이해하고 XML 레이아웃 파일에서 중력 태그를 사용하고 있지만 효과가없는 것 같습니다.도움말 Android의 화면에 TextView 객체 정렬
누군가가 방금 화면에 텍스트 뷰를 배치하는 방법에 대한 가이드를 제공하고 해당 내용을 프로그래밍 방식으로 제어 할 수 있도록 코드에 링크 할 수도 있습니까 (이 방법은 = (TextView) findViewById (r .id.resourcename))?
많은 감사
XML :
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<android.gesture.GestureOverlayView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gestures"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gestureStrokeWidth="2.0"
android:gestureStrokeType="multiple"
android:eventsInterceptionEnabled="true">
<com.darius.android.distractions.DistractionsView
android:id="@+id/distractions_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/text"
android:text="Hello"
android:visibility="visible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center_horizontal"
android:textColor="#88ffffff"
android:textSize="24sp"/>
<TextView
android:id="@+id/textLevel"
android:text="@string/level_count"
android:visibility="visible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="bottom"
android:textColor="#EB0000"
android:textSize="10sp"/>
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/concentration_bar"
android:textColor = "#EB0000"
android:textSize="10sp"
android:id="@+id/conbartext"
android:visibility="visible"
></TextView>
</RelativeLayout>
</android.gesture.GestureOverlayView>
</FrameLayout>
아, 덕분에 튜토리얼을 읽고 레이아웃의 차이를 깨달았습니다. 매우 유익한! – ComethTheNerd