2016-04-22 16 views
0

Wenn ich auf eine Schaltfläche klicke, muss ich meine Aktivität im Vollbildmodus einstellen. Suche im Internet habe ich den Code dafür gefunden.Vollbild android

Aber ich mache etwas falsch, weil Statusleiste und Navigationsleiste verschwindet und meine Aktivität mit der gleichen Höhe rainain.

before

after

Dies ist der video.xml

<?xml version="1.0" encoding="utf-8"?>        
<android.support.design.widget.CoordinatorLayout 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:fitsSystemWindows="true"         
    tools:context=".VideoActivity">         

    <include layout="@layout/content_video" />      

    <android.support.design.widget.FloatingActionButton    
     android:id="@+id/close"          
     android:layout_width="wrap_content"       
     android:layout_height="wrap_content"       
     android:layout_gravity="bottom|center_horizontal"    
     android:layout_marginBottom="70dp"       
     android:layout_marginRight="80dp"        
     android:src="@drawable/phone"         
     app:elevation="0dp"           
     app:backgroundTint="#44FF0000" />        

    <android.support.design.widget.FloatingActionButton    
     android:id="@+id/screen"          
     android:layout_width="wrap_content"       
     android:layout_height="wrap_content"       
     android:layout_gravity="bottom|center_horizontal"    
     android:layout_marginBottom="70dp"       
     android:layout_marginLeft="80dp"        
     android:src="@drawable/fullscreen"       
     app:elevation="0dp"           
     app:backgroundTint="#44000000"/>        

</android.support.design.widget.CoordinatorLayout> 

Und das content_video.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" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:context=".VideoActivity" 
    tools:showIn="@layout/video" 
    android:id="@+id/layout" 
    android:orientation="horizontal"> 

    <RelativeLayout 
     android:id="@+id/container" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="#000000"> 
    </RelativeLayout> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textAppearance="?android:attr/textAppearanceSmall" 
     android:text="@string/string_video_id" 
     android:id="@+id/conference_id" 
     android:textColor="@android:color/white" 
     android:enabled="false" 
     android:focusable="false" 
     android:alpha="0.5" 
     android:background="@color/button_background" 
     android:paddingLeft="10dip" 
     android:paddingTop="5dip" 
     android:paddingRight="10dip" 
     android:paddingBottom="5dip" 
     android:layout_marginBottom="20dp" 
     android:layout_marginLeft="10dp" 
     android:gravity="bottom" 
     android:layout_alignParentBottom="true"/> 

</RelativeLayout> 

Kann mir jemand helfen plase? Dank

Antwort

0

Es kann ein besserer Weg, es zu tun, aber der einfachste Weg, ich benutze, ist,

// Fullscreen 
    requestWindowFeature(Window.FEATURE_NO_TITLE); 
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 

ich dieses in der Aktivitätsklasse.

+0

Ich habe dies schon einmal versucht und funktioniert gut, aber es versteckt nicht die Navigationsleiste –

+0

Versuchen Sie den bearbeiteten Code. Das entfernt auch die Titelleiste. – Fuzzie