帮助在Android中排列屏幕上的TextView对象

帮助在Android中排列屏幕上的TextView对象,android,xml,textview,Android,Xml,Textview,我使用textview对象在我的游戏屏幕上保存诸如分数、级别等标签,但它们似乎没有显示在我想要的位置。我了解视图层次结构父母、孩子和我在XML布局文件中使用重力标记,但它似乎没有任何效果 是否有人可以快速提供一个指南,让您在屏幕上定位textview对象,并在代码中链接它,以便通过编程方式控制其内容?我相信这可以通过=textview findViewByIdr.id.resourcename完成 非常感谢 XML: 是布局基础知识的良好指南。重力标记仅在某些布局类型中有意义 另一个有用的工具

我使用textview对象在我的游戏屏幕上保存诸如分数、级别等标签,但它们似乎没有显示在我想要的位置。我了解视图层次结构父母、孩子和我在XML布局文件中使用重力标记,但它似乎没有任何效果

是否有人可以快速提供一个指南,让您在屏幕上定位textview对象,并在代码中链接它,以便通过编程方式控制其内容?我相信这可以通过=textview findViewByIdr.id.resourcename完成

非常感谢

XML:

是布局基础知识的良好指南。重力标记仅在某些布局类型中有意义

另一个有用的工具是Hierarchy查看器,可以在Android安装的tools文件夹中找到。这允许您可视化您跑步活动的视图权限


如果您发布您的布局XML,以及您试图实现的模型,我们可能会帮助您实现它。

以下是一些关于android布局和小部件入门的非常有用的教程:

关于布局本身的文档和指南如下:

已添加我的XML。在面向横向的屏幕上,我想在屏幕右下角放置一个Score textview标签,该标签链接到integer Score变量,例如,它显示Score:1000。也许在它的左边有一个类似的textview对象,上面写着Level:3。非常感谢您的时间和帮助啊,谢谢,阅读该教程并意识到布局的不同。信息量很大!
<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>