[英]textview background color is lost during screen rotation
I'm trying to fix a bug in this app called mizuu, there is a Horizontal Card Layout for movies and tv shows of a select actor, there a button to show more on the upper right hand side corner of the layout which has a grey background color but when rotating orientation to landscape mode and vice versa the background color of "see more" text is lost , is there a way to solve this issue? 我正在尝试修复此名为mizuu的应用程序中的错误,该电影有用于选择演员的电影和电视节目的水平卡布局,在该布局的右上角有一个按钮以显示更多内容,该按钮具有灰色背景色,但是将方向旋转到横向模式(反之亦然)时,“查看更多”文本的背景色会丢失,有没有办法解决此问题?
files 档案
actor_details.xml actor_details.xml
horizontal_grid_items.xml horizontal_grid_items.xml
HorizontalCardLayout.java https://pastebin.com/s6uPkBht HorizontalCardLayout.java https://pastebin.com/s6uPkBht
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/abc_list_selector_disabled_holo_dark"
android:orientation="vertical"
android:paddingLeft="@dimen/content_details_baseline_margin"
android:paddingRight="@dimen/content_details_baseline_margin"
android:paddingBottom="@dimen/content_details_baseline_margin">
<com.miz.views.HorizontalCardLayout
android:id="@+id/actor_movie_cards"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/details_medium_padding" />
<com.miz.views.HorizontalCardLayout
android:id="@+id/actor_tv_cards"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/details_medium_padding" />
<com.miz.views.HorizontalCardLayout
android:id="@+id/actor_photo_cards"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/details_medium_padding" />
<com.miz.views.HorizontalCardLayout
android:id="@+id/actor_tagged_photo_cards"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/details_medium_padding" />
</LinearLayout>
<TextView
android:id="@+id/see_more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:background="@color/card_background_dark"
android:paddingBottom="2dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:paddingTop="2dp"
android:text="@string/see_more"
android:textAllCaps="true"
android:textColor="@color/card_title_color"
android:layout_marginRight="@dimen/horizontal_card_layout_title_padding"
android:visibility="gone" />
I think this issue occurred because of code in your activity somehow make this view gone, i suggestion set configChanges orientation in AndroidManifest. 我认为发生此问题是由于您的活动中的代码以某种方式使该视图消失了,我建议在AndroidManifest中设置configChanges方向。
<activity
...
android:configChanges="orientation|screenSize|keyboardHidden|smallestScreenSize|screenLayout"
https://developer.android.com/guide/topics/resources/runtime-changes https://developer.android.com/guide/topics/resources/runtime-changes
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.