0

我有几个文本视图,它们在相对布局的横向视图中占据了大部分屏幕,并且我设置的字体大小非常大(150dp)。文本视图都是计时器,最右边的是“秒”文本视图。

我的问题是,在具有小屏幕分辨率的手机上进行测试时,秒数超出了屏幕的限制并且无法看到。它们在普通到大屏幕分辨率上处于完美位置,而不是在小屏幕上。

有什么办法可以强制“秒”文本视图留在屏幕上,而无需调整每个文本视图之间的字体大小或边距?即使这意味着在小屏幕上看起来局促,我也可以忍受。

任何帮助是极大的赞赏。

谢谢

这是包含小时和分钟文本视图的相对布局和线性布局的相应代码

<?xml version="1.0" encoding="utf-8"?>
      <RelativeLayout android:id="@+id/RelativeLayout01"
       android:layout_width="fill_parent" android:layout_height="fill_parent"
       xmlns:android="http://schemas.android.com/apk/res/android"
       android:keepScreenOn="true" android:background="@drawable/background2">


<RelativeLayout android:id="@+id/RelativeLayout08"

android:paddingLeft="20dip" android:paddingRight="30dip"
android:background="@drawable/trans_img" android:layout_centerHorizontal="true" 
android:paddingBottom="20dip" android:layout_centerVertical="true" 
android:layout_height="wrap_content" android:layout_width="wrap_content">

<LinearLayout android:id="@+id/LinearLayout01"
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:layout_centerVertical="true">

<TextView android:id="@+id/TextViewHr1" 
android:layout_width="wrap_content" android:layout_height="wrap_content" 
android:layout_marginRight="5dip" android:gravity="right" 
android:textColor="@color/white" android:textSize="150dp" 
android:layout_marginLeft="5dip"></TextView>

<TextView android:id="@+id/TextViewHr2" 
android:layout_width="wrap_content" android:layout_height="wrap_content" 
android:layout_marginLeft="5dip" android:layout_marginRight="5dip" 
android:gravity="right" android:textColor="@color/white" 
android:textSize="150dp"></TextView>

<TextView android:id="@+id/TextViewSeperate" 
android:layout_width="wrap_content" android:layout_marginLeft="5dip" 
android:layout_marginRight="5dip" android:layout_gravity="center_vertical" 
android:background="@drawable/colon" android:layout_height="55dip"></TextView>

<TextView android:id="@+id/TextViewMin1" 
android:layout_width="wrap_content" android:layout_height="wrap_content" 
android:layout_marginLeft="5dip" android:layout_marginRight="5dip" 
android:gravity="right" android:textColor="@color/white" 
android:textSize="150dp"></TextView>

<TextView android:id="@+id/TextViewMin2" 
android:layout_height="wrap_content" android:layout_marginLeft="5dip"
android:gravity="right" android:layout_width="wrap_content" 
android:textColor="@color/white" android:textSize="150dp" 
android:layout_marginRight="5dip"></TextView
</LinearLayout>

这是第二个线性布局的代码,在这个相对布局 8 中:

<LinearLayout android:id="@+id/LinearLayout02"
android:layout_width="wrap_content" android:layout_height="wrap_content" 
android:orientation="vertical" android:layout_centerVertical="true"
android:layout_toRightOf="@+id/LinearLayout01" android:layout_marginLeft="20dip">

<TextView android:id="@+id/TextViewSeconds" 
android:layout_height="wrap_content" android:text="20" 
android:layout_marginTop="5dip" android:textColor="@color/white" 
android:textSize="55dip" android:layout_width="wrap_content"></TextView>
4

1 回答 1

0

我会尝试设置 layout_weight 设置。

要做到这一点,请尝试以下操作:在 parent weight_sum = "1.0"中设置

在子百分比值中,他们需要占用多少空间,即layout_weight="0.8"layout_weight="0.2",请记住在父元素的所有元素中设置layout_width = "0dp"

于 2011-02-17T13:19:20.373 回答