Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/181.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 将TextView放置在不同设备上的相同位置_Android_Xml_Screen - Fatal编程技术网

Android 将TextView放置在不同设备上的相同位置

Android 将TextView放置在不同设备上的相同位置,android,xml,screen,Android,Xml,Screen,我有一个代码,可以生成一个特定日期的倒计时文本视图,我已经定位到了可以在我的设备上使用的完美位置,但是当我使用屏幕大小更大或更小的设备时,文本视图会移动到不合适的位置。如何将其放置在所有设备的相同位置 这是我的密码: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:components="http://schemas.android.com/apk/res-auto" xml

我有一个代码,可以生成一个特定日期的倒计时文本视图,我已经定位到了可以在我的设备上使用的完美位置,但是当我使用屏幕大小更大或更小的设备时,文本视图会移动到不合适的位置。如何将其放置在所有设备的相同位置

这是我的密码:

<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:components="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/newbackground"
android:orientation="vertical"
tools:context=".MainActivity">

<LinearLayout
    android:id="@+id/linear_layout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="70dp">

    <TextView
        android:id="@+id/countdown_text_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fontFamily="sans-serif-thin"
        android:gravity="center_horizontal"
        android:textColor="#F44336"
        android:textSize="20sp"/>

你的确切意思是什么?你能显示一个屏幕截图吗?所以,我有一个带有白框的应用程序背景图像,我已经定位了TextView,使它显示在这个白框内,但是当我在其他设备上尝试时,TextView会在白框的上方或下方移动。你的TextView应该保持在屏幕的中间吗,在相对位置上,如左或右中心…,或者您的白盒处于您需要使用特定度量达到的自定义位置?因此,白盒位于设置为应用程序的“我的背景”的图像上。例如,当我将其加载到更大的设备上时,图像的大小会调整以满足设备屏幕大小的需要,但是文本视图不会移动。如果这让更多的老师需要知道白盒在背景上的确切位置,我真的无法帮到其他人^^