hello guys i started to learn to build android applications via udacy. After a long troubleshooting i didnt find something that can cause the bug that i have. the bug is that when i rotate the phone the view seems to clone it self and not deleting the previous one if someone can help me ill be very happy. 1) normal state of app:
3) and after another rotation the application crashing
it never happend until i added the code in the xml file of the view:
<?xml version="1.0" encoding="utf-8"?> <!-- Layout for weather forecast list item for future day (not today) --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical" android:minHeight="?android:attr/listPreferredItemHeight" android:orientation="horizontal" android:padding="16dp"> <ImageView android:id="@+id/list_item_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher"/> <LinearLayout android:layout_height="wrap_content" android:layout_width="0dp" android:layout_weight="1" android:orientation="vertical" android:paddingLeft="16dp"> <TextView android:id="@+id/list_item_date_textview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Tomorrow"/> <TextView android:id="@+id/list_item_forecast_textview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Clear"/> </LinearLayout> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:layout_weight="1" android:gravity="right"> <TextView android:id="@+id/list_item_high_textview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="81" android:paddingLeft="10dp"/> <TextView android:id="@+id/list_item_low_textview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="68" android:paddingLeft="10dp"/> </LinearLayout> </LinearLayout>
No comments:
Post a Comment