android相对布局和图像背景

android相对布局和图像背景,android,image,Android,Image,假设我有一个相对布局的背景图像。这个图像是一个圆圈,在圆圈内我放置了一个带有单个字母的文本视图,我如何在圆圈内保持文本视图? 我制作的图像始终保持相同的分辨率,但有时字母仍在圆圈外 另外,为高dpi、中等dpi等创建所有不同的布局是行不通的 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:

假设我有一个相对布局的背景图像。这个图像是一个圆圈,在圆圈内我放置了一个带有单个字母的文本视图,我如何在圆圈内保持文本视图? 我制作的图像始终保持相同的分辨率,但有时字母仍在圆圈外

另外,为高dpi、中等dpi等创建所有不同的布局是行不通的

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/ScrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:gravity="center" >

    <TextView
        android:id="@+id/Title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#000000"
        android:gravity="center"
        android:text="Majore C "
        android:textColor="#FFFFFF"
        android:textSize="40sp" />

    <RelativeLayout
        android:layout_width="1090dp"
        android:layout_height="1920dp"
        android:background="@drawable/backright3" >

        <TextView
            android:id="@+id/A"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBaseline="@+id/E"
            android:layout_alignBottom="@+id/E"
            android:layout_toRightOf="@+id/E"
            android:background="@drawable/bg_red"
            android:text=" A "
            android:textColor="@color/Red"
            android:textSize="20sp" />
试试这个:

<RelativeLayout
    android:layout_width="1090dp"
    android:layout_height="1090dp"
    android:background="@drawable/backright3">

    <TextView
        android:layout_width="1090dp"
        android:layout_height="1090dp"
        android:text="A"
        android:id="@+id/A"
        android:textColor="#ffffff"
        android:textSize="20sp"
        android:gravity="center"
        android:background="@drawable/bg_red"
        android:textColor="@color/Red"
        android:layout_margin="6dp" />
</RelativeLayout>
许多文本视图的更新:

<RelativeLayout
            android:layout_width="1090dp"
            android:layout_height="1090dp"
            android:background="@drawable/backright3">

            <LinearLayout
                android:orientation="horizontal"
                android:layout_width="1090dp"
                android:layout_height="1090dp"
                android:layout_margin="6dp"
                android:gravity="center">
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="A"
                    android:id="@+id/A"
                    android:textColor="#ffffff"
                    android:textSize="20sp"
                    android:background="@drawable/bg_red"
                    android:textColor="@color/Red"/>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="B"
                    android:id="@+id/B"
                    android:textColor="#ffffff"
                    android:textSize="20sp"
                    android:background="@drawable/bg_red"
                    android:textColor="@color/Red"/>

                //Other texts.......

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Z"
                    android:id="@+id/Z"
                    android:textColor="#ffffff"
                    android:textSize="20sp"
                    android:background="@drawable/bg_red"
                    android:textColor="@color/Red"/>
            </LinearLayout>
</RelativeLayout>

注:文本数量取决于文本大小和父版面宽度:

发布您的尝试代码它有点太大,文件太多,您有什么建议吗?关于如何在切换到不同的屏幕和方面时保持文本视图,我提出了一些建议,但我必须确定您到底需要什么。这就是为什么我要求查看您的代码。只要xml文件,如果它太大,试着删除额外的视图,然后发布我发布的内容,类似这样的内容使用android:centerInParent=true属性作为letter textview。因此,如果我不是只有1个字母,我有100个,我指定了它们的宽度和高度,它们在图像中总是处于相同的位置?如果我没有只有一个字母,而我有一百个字母,你是什么意思?同一个文本视图有百个字母或百个文本视图,每个视图有一个字母?100个文本视图,每个视图有一个字母,我将它们放在图像背景中,并希望始终在那里,无论我需要文本视图在相对布局中是什么,我想我会使用您的第一个建议,使用许多具有固定高度和宽度的文本视图,那应该行的,谢谢