Изображения рассказывают все, я получаю второе изображение после изменения ориентации от портрета к пейзажу, а затем снова обращаясь к начальной ориентации, которая является портретом. Когда я опускаю TextView, все в порядке. Текст представляет собой две строки в портрете, и он становится одной строкой в альбомной ориентации. Кажется, это искажает ImageView.Android ImageView искажен после портрета => пейзаж => портрет
В коде фрагмента, я делаю:
View view = inflater.inflate(R.layout.fragment_luminescence, container, false);
mTextView = (TextView) view.findViewById(R.id.readings_detail);
return view;
Это мой фрагмент XML:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.selcukcihan.android.sensors.PressureFragment">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/readings_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_gravity="center_horizontal"
android:textColor="@color/primary_text"
android:text="@string/hello_blank_fragment" />
<ImageView
android:id="@+id/luminescence_circle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/app_name"
android:src="@drawable/circle" />
</LinearLayout>
</FrameLayout>
Это circle.xml:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval" >
<gradient
android:endColor="@color/dark"
android:gradientRadius="20dp"
android:startColor="@color/icons"
android:type="radial"
android:layout_width="match_parent"
android:layout_height="match_parent">
</gradient>
<size
android:height="100dp"
android:width="100dp"/>
</shape>
Редактирование: я вызываю setText в TextView, когда изменяется показания сенсора, однако строка является только постоянной для этого конкретного датчика. Теперь интересная часть, если я не вызываю setText и оставляю текст как есть, он правильно отображает круг. Я озадачен этим поведением.
TextVieww и ImageView находятся в LinearLayout внутри фрагмента (FrameLayout). Если я поместил его в RelativeLayout, все равно. –