2016-04-28 8 views
0

このようにしてsurfaceViewを作成しました。SurfaceViewのFullScreenがロリポップ以上で動作しない

content_main.xml

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingBottom="0dp" 
    android:paddingLeft="0dp" 
    android:paddingRight="0dp" 
    android:paddingTop="0dp" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:context="com.networks.streaming.surfaceviewfullscreentest.MainActivity" 
    tools:showIn="@layout/activity_main"> 

    <SurfaceView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/liveSurfaceView" 
     android:layout_alignParentTop="true" 
     android:layout_centerHorizontal="true" 
     android:nestedScrollingEnabled="false"/> 
</RelativeLayout> 

MainActivity.java

@Override 
    protected void onCreate(Bundle savedInstanceState) 
    { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 
    setSupportActionBar(toolbar); 

    SurfaceView liveSurfaceView = (SurfaceView) findViewById(R.id.liveSurfaceView);  
    liveSurfaceView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 
      | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 
      | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar 
      | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar 
      | View.SYSTEM_UI_FLAG_IMMERSIVE 
     ); 
    getSupportActionBar().hide(); 
    } 

このコードでは、キットカット(API 19)を実行しているAndroidデバイスで動作します。ロリポップ以上のデバイスで同じコードを実行すると、結果として得られる表示はこのようになります。

enter image description here

UPER及び下部境界は可視であり、surfaceView全画面をカバーしていません。どうすればこの問題を解決できますか?ありがとう

答えて

0

これは例です!!!

<application android:allowBackup="true" 

    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name"  
    android:theme="@style/AppTheme.NoActionBar"> 
    <activity android:name=".MainActivity" android:label="@string/app_name" 
     android:screenOrientation="portrait"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 

</application> 

ロリポップ以降でフルスクリーンにする方法

<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.Light.NoActionBar"> 
    <item name="windowActionBar">false</item> 
    <item name="windowNoTitle">true</item> 
    <item name="android:windowFullscreen">true</item> 

</style> 
+0

をstyle.xmlに追加しますか?システムバーとナビゲーションバーは引き続き表示されます。 –

+0

テーマを使用するNoActiBar.FullScreen –

+0

@android:style/Theme.NoTitleBar.Fullscreen –

関連する問題