向きを変更した後、テキストビューに混乱する問題があります。
<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
ただし、ランドスケープに戻した後、結果は 74 (以前は 69) に設定され、両方の結果は今後変更されません。
アプリを縦向きモードで起動した場合の結果は 76 と 74 です。
ランドスケープで開始したときに数値が異なるのはなぜなのか、本当に興味があります。助けていただければ幸いです。
情報: アクティビティが設定されましたandroid:screenOrientation="sensor"
編集: Android > 4 を使用している場合にのみ問題が発生するようです。
ありがとう。