【发布时间】:2016-03-15 07:35:08
【问题描述】:
我已经尝试了所有方法,但还没有成功。
发生了什么。当标题文本较小时,它应该位于父级的中心,完美地工作,但是当文本大小很大时,它会与左侧组件重叠
我想要什么:它不应该重叠,而是出现在 settings Textview 的下一个。当尺寸增加时应该调整它。
代码
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@android:color/darker_gray" >
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Settings"
android:gravity="center_vertical"
android:layout_alignParentLeft="true"
android:textColor="@android:color/holo_orange_dark"
android:textSize="16.0sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="hiiiiiiiiiiiii StackOverflower!!!!!!!!!!!"
android:padding="4dp"
android:gravity="center"
android:layout_toLeftOf="@+id/txtBack"
android:textColor="@android:color/white"
android:textSize="19sp" />
</RelativeLayout>
【问题讨论】:
-
你为什么使用相对布局而不是工作会相对布局。
标签: android android-layout android-relativelayout android-framelayout