Android RelativeLayout中的不同GUI分辨率
我有一个关于android不同分辨率的问题。我在RelativeLayout中编写了一个xml GUI文件。我创建了一些小图片,在图片旁边我想要文本视图。我的问题发生在我更改分辨率时,文本视图“文本”会移动,我很惊讶这在不同的分辨率下看起来很糟糕 我现在所做的,例如,我创建了一个图像,我创建了一个文本视图,这个文本视图位于另一个图像的下方,例如19像素。 但是如果我改变分辨率,19个像素的距离可能太远,也可能太小,来自texview的文本将显示在屏幕上的错误位置 我怎样才能用不同的分辨率来解决这个问题,并创建一个具有RealtiveLayout(以像素为单位定义距离)的GUI。通常我希望不同文本视图之间的距离在20像素左右,正如您在下面的代码中看到的那样 这是我的示例代码:Android RelativeLayout中的不同GUI分辨率,android,android-layout,android-relativelayout,Android,Android Layout,Android Relativelayout,我有一个关于android不同分辨率的问题。我在RelativeLayout中编写了一个xml GUI文件。我创建了一些小图片,在图片旁边我想要文本视图。我的问题发生在我更改分辨率时,文本视图“文本”会移动,我很惊讶这在不同的分辨率下看起来很糟糕 我现在所做的,例如,我创建了一个图像,我创建了一个文本视图,这个文本视图位于另一个图像的下方,例如19像素。 但是如果我改变分辨率,19个像素的距离可能太远,也可能太小,来自texview的文本将显示在屏幕上的错误位置 我怎样才能用不同的分辨率来解决这
<?xml version="1.0" encoding="utf-8"?>
<ScrollView android:id="@+id/ScrollView01"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1"
android:weightSum="1.0"
android:background="#adaeb5">
<TextView android:text="@+id/TextView03" android:id="@+id/TextView03"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:textStyle="bold"
android:textSize="21dp"
android:shadowDy="1.5"
android:textColor="#FFFFFF"
android:shadowColor="#212421"
android:shadowRadius="1.5"
android:shadowDx="1.5"/>
<ImageView android:id="@+id/ImageView01"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/TextView03" android:paddingTop="35px"
/>
<ImageView android:id="@+id/ImageView02"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/ImageView01" android:paddingTop="20px"
/>
<ImageView android:id="@+id/ImageView03"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/ImageView02" android:paddingTop="20px"
/>
<ImageView android:id="@+id/ImageView04"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/ImageView03" android:paddingTop="20px"
/>
<TextView android:text="@+id/TextView01" android:id="@+id/TextView01"
android:shadowDy="1.0"
android:shadowColor="#bdbebd"
android:shadowRadius="1.0"
android:shadowDx="1.0"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#212421"
android:layout_toRightOf="@+id/ImageView01" android:layout_below="@+id/TextView03" android:paddingTop="36px"/>
<TextView android:text="@+id/TextView02" android:id="@+id/TextView02"
android:shadowDy="1.0"
android:shadowColor="#bdbebd"
android:shadowRadius="1.0"
android:shadowDx="1.0"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#212421"
android:layout_below="@+id/TextView01" android:layout_toRightOf="@+id/ImageView02" android:paddingTop="25px"/>
<TextView android:text="@+id/TextView04" android:id="@+id/TextView04"
android:shadowDy="1.0"
android:shadowColor="#bdbebd"
android:shadowRadius="1.0"
android:shadowDx="1.0"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#212421"
android:layout_below="@+id/TextView02" android:layout_toRightOf="@+id/ImageView03" android:paddingTop="15px"/>
<TextView android:text="@+id/TextView05" android:id="@+id/TextView05"
android:shadowDy="1.0"
android:shadowColor="#bdbebd"
android:shadowRadius="1.0"
android:shadowDx="1.0"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#212421"
android:layout_below="@+id/TextView04" android:layout_toRightOf="@+id/ImageView04" android:paddingTop="19px"/>
<TextView android:text="@+id/TextView07" android:id="@+id/TextView07"
android:textStyle="bold"
android:textSize="21dp"
android:shadowDy="1.5"
android:textColor="#FFFFFF"
android:shadowColor="#212421"
android:shadowRadius="1.5"
android:shadowDx="1.5"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:layout_below="@+id/TextView05" android:paddingTop="30px"/>
<TextView android:text="@+id/TextView08" android:id="@+id/TextView08"
android:shadowDy="1.0"
android:shadowColor="#bdbebd"
android:shadowRadius="1.0"
android:shadowDx="1.0"
android:paddingLeft="20px"
android:paddingRight="25px"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#212421" android:textSize="16dp"
android:layout_below="@+id/TextView07" android:layout_toRightOf="@+id/ImageView05" android:paddingTop="20px" android:paddingBottom="20px"/>
<Button android:id="@+id/help_button2" android:layout_below="@+id/TextView08"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:text="Previous" />
</RelativeLayout>
</ScrollView>
/无论您在哪里编写
px
,thx都会提前更改dp
。这是android本身支持和建议的