Android 以横向方向启动时,TextView行边界值不匹配
方向改变后,我的文本视图有一个令人困惑的问题:Android 以横向方向启动时,TextView行边界值不匹配,android,android-layout,screen-orientation,Android,Android Layout,Screen Orientation,方向改变后,我的文本视图有一个令人困惑的问题: <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:text="Simple"
android:layout_width="fill_parent"
android:layout_height="200dp"
android:background="@drawable/my_color_drawable"
android:id="@+id/text1"
android:layout_gravity="center"/><\FrameLayout>
当我以横向模式启动应用程序时,方法getLineBounds(1,tmpRect)
结果:
- tmpRect.top=69
- tmpRect.top=76
谢谢。使用横向和纵向时需要两种布局,否则值会更改。它根据创建布局的方向设置为默认值。 如果只需要在一种模式下工作,则设置为
android:screenOrientation="portrait"
或
我必须在两种模式下工作,只有一种布局(没有陆地端口差异),我的问题是,文本边界只有在我启动应用程序时无效,而不是在整个时间内无效,这就是我问题的原因(陆地端口工作不好[在第一个陆地文本有无效边界,端口好,第二个陆地也好]但当应用程序在港口启动时(景观一直运行良好)
android:screenOrientation="landscape"