2015-09-25 152 views
0

我知道這裏有一堆問題,但我的問題是特定於我的代碼。MyActivity不斷崩潰(Android Studio)

下面是我

public class LoginActivity extends AppCompatActivity { 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 

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

     setContentView(R.layout.activity_login); 
    } 

    { 

    @Override 
    public boolean supportRequestWindowFeature (int featureId); 

    } 
} 

我已經添加了這部分,因爲我沒有想操作欄和頂部欄上的顯示應用,

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

但現在,由於某種原因,下面的語法與我的應用程序的啓動相沖突:

@Override 
public boolean supportRequestWindowFeature (int featureId); 

我真的迷失了對n流。我不明白爲什麼Android Studio會告訴我它期待着冒號「;」而且不明白爲什麼它告訴我的註解是不允許在這條線上,

public boolean supportRequestWindowFeature (int featureId); 

這裏是一個快照http://i.imgur.com/F0W6M1v.png?1

在此先感謝任何人誰困擾,幫助菜鳥了! :)

+1

如果應用程序崩潰...發表您的logcat:http://stackoverflow.com/help/mcve –

+1

supportRequestwindowfeature;(); - > supportRequestwindowfeature(){} – dex

回答

1

刪除「{」之前您的@Override和「;」前「(」在

@Override 
protected void onCreate(..){ 

} 

@Override 
public booleansupportRequestWidownFeature(int ....){ 

} 
0

我認爲它是因爲你把奇特的你的功能。

public class LoginActivity extends AppCompatActivity { 


@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 



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


    setContentView(R.layout.activity_login); 
} 



@Override 
public boolean supportRequestWindowFeature (int featureId) 
{ 

} 
} 
0

如果你想要的是沒有行動起來吧......

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> 

身臨其境模式...

@Override 
public void onWindowFocusChanged(boolean hasFocus) 
{ 
    super.onWindowFocusChanged(hasFocus); 
    if (hasFocus) { 
     mainScreen.setSystemUiVisibility(
       View.SYSTEM_UI_FLAG_LAYOUT_STABLE 
         | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 
         | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 
         | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION 
         | View.SYSTEM_UI_FLAG_FULLSCREEN 
         | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); 
    } 
} 
0

1.public class Login Activity擴展Activity;

2.in AndoridManifest.XML文件,補充一點:

<activity android:name=".LoginActivity" 
android:theme="@style/Theme.AppCompat.NoActionBar"> 

,並刪除requestWindowFeature(Window.FEATURE_NO_TITLE);