Android 如何创建具有多条线的正确显示视图?
我使用一个列表来显示一组包含多个文本的项目。我希望每个项目中有2个TextView对象。我的问题是,当用户更改文本大小时(例如:当用户有眼睛问题时,他可能会增加系统字体大小),我无法调整属性以保持正确,这完全破坏了我的视图 第一个文本应该在布局的中心上方,第二个文本应该在中心下方,但它们不应该在不同的字体大小上“合并”。我曾想过在文本中插入一个视图,并将文本的格式设置为相对于中心(不可见)视图的位置,但这听起来有点老练和无效。最好的方法是什么 我的当前布局文件:Android 如何创建具有多条线的正确显示视图?,android,user-interface,Android,User Interface,我使用一个列表来显示一组包含多个文本的项目。我希望每个项目中有2个TextView对象。我的问题是,当用户更改文本大小时(例如:当用户有眼睛问题时,他可能会增加系统字体大小),我无法调整属性以保持正确,这完全破坏了我的视图 第一个文本应该在布局的中心上方,第二个文本应该在中心下方,但它们不应该在不同的字体大小上“合并”。我曾想过在文本中插入一个视图,并将文本的格式设置为相对于中心(不可见)视图的位置,但这听起来有点老练和无效。最好的方法是什么 我的当前布局文件: <RelativeLayo
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="72dp">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"/>
<android.support.v7.widget.AppCompatTextView
android:id="@+id/upper_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignTop="@+id/icon"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:layout_marginLeft="16dp"
android:layout_toEndOf="@id/icon"
android:layout_toRightOf="@+id/icon"
android:singleLine="true"
android:textSize="16sp" />
<android.support.v7.widget.AppCompatTextView
android:id="@+id/lower_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/upper_text"
android:layout_alignParentBottom="true"
android:layout_alignStart="@+id/upper_text"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:singleLine="true"
android:textSize="14sp" />
</RelativeLayout>
我知道我应该去掉下页边距和alignParent*内容,但我不知道该怎么办。使用recyclerview,很容易将数据更新到布局。
发布您的代码和问题案例的图片。除非你做了一些奇怪的事情,否则这是一个不寻常的问题。请尝试提供一些代码。