我正在尝试修复此名为mizuu的应用程序中的错误,该电影有用于选择演员的电影和电视节目的水平卡布局,在该布局的右上角有一个按钮可以显示更多内容的背景颜色为灰色,但是将方向旋转为横向模式时(反之亦然),则会丢失“查看更多”文本的背景颜色,有没有办法解决此问题?
文件
actor_details.xml
horizontal_grid_items.xml
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" />
答案 0 :(得分:0)
我认为发生此问题是由于您的活动中的代码以某种方式使该视图消失了,我建议在AndroidManifest中设置configChanges方向。
<activity
...
android:configChanges="orientation|screenSize|keyboardHidden|smallestScreenSize|screenLayout"
https://developer.android.com/guide/topics/resources/runtime-changes