【发布时间】:2019-01-21 16:35:27
【问题描述】:
我有两个图像的视图
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/top_section"
android:orientation="vertical"
android:layout_marginTop="120dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="170dp"
android:id="@+id/top_image"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/top_text"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/bottom_section"
android:orientation="vertical"
android:layout_alignParentBottom="true">
<ImageView
android:layout_width="match_parent"
android:layout_height="170dp"
android:id="@+id/bottom_image"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/bottom_text"/>
</LinearLayout>
我想让它在用户单击图像视图时变成全屏并正确旋转以占据全屏。
到目前为止我已经尝试过(例如,如果点击顶部)
topText.setVisibility(View.GONE)
bottomSection.setVisibility(View.GONE)
getSupportActionBar().hide();
getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
但图像并不是真正的全屏。我将如何使图像全屏显示?我一直在考虑可能有三分之一的图像视图,并使其与宽度和高度的父级匹配,并使其在点击时可见。
【问题讨论】:
-
您将图像高度设为 170dp。将 match_parent 设为 top_image
标签: android android-layout imageview android-imageview fullscreen