0
immersive mode
をviewPager
と使用すると、表示 - >fullscreen_content
はで、フルスクリーンにリサイズされません。ViewPagerを使用した没入型モード
しかし、テンプレート内の同じコードを使用してアンドロイドスタジオで提供されてうまく動作します。
これは、android:fitsSystemWindows="true"
と関係があります。
下のスクリーンショットが表示されている場合は、緑の色がandroid:fitsSystemWindows="true"
を使用するビューの背景になり、デバッグ用のアクティビティ全体の背景として明るい色が使用されます。
解決策は何ですか&他の方法がありますか?没入
<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"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".Camera.CameraActivity">
<FrameLayout
android:fitsSystemWindows="true"
android:background="@color/colorAccent"
android:id="@+id/fullscreen_content"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Camera.CameraActivity">
<com.brotherpowers.audiojournal.View.AJViewPager
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.viewpagerindicator.CirclePageIndicator
android:id="@+id/viewpager_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:padding="@dimen/spacing.8"
app:fillColor="@color/viewpager_active"
app:pageColor="@color/viewpager_inactive"
app:strokeColor="@android:color/transparent"/>
</RelativeLayout>
</FrameLayout>
JAVAアクティビティショーを実装
XML活性は/非表示フルスクリーン
private final Handler uiHandler = new Handler(); private boolean fullScreen; private void hide() { // Hide UI first ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.hide(); } fullScreen = true; // Schedule a runnable to remove the status and navigation bar after a delay uiHandler.removeCallbacks(showRunnable); uiHandler.postDelayed(hideRunnable, 100); } private void show() { // Show the system bar _contentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION); fullScreen = false; // Schedule a runnable to display UI elements after a delay uiHandler.removeCallbacks(hideRunnable); uiHandler.postDelayed(showRunnable, 100); } private final Runnable showRunnable =() -> { // Delayed display of UI elements ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.show(); } _contentView.requestLayout(); }; private final Runnable hideRunnable =() -> { // removal of status and navigation bar _contentView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); _contentView.requestLayout(); };
コメントはありません。コードのみの回答=悪い回答。 – WarrenFaith