2015-09-22 24 views
10

Sto provando a creare un'applicazione a schermo intero e quando la eseguo in un Acer Iconia 8, il titolo non viene visualizzato ma i pulsanti di azione appaiono ancora:Theme.AppCompat.Light.NoActionBar.FullScreen Non funziona con Android 4.4

AndroidManifest.xml

<application 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"> 
    <activity 
     android:name=".MainActivity" 
     android:windowSoftInputMode="adjustResize" 
     android:configChanges="orientation|keyboardHidden"> 

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

<uses-permission android:name="android.permission.INTERNET" /> 

e stili:

<resources> 

    <!-- Base application theme. --> 
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
     <!-- Customize your theme here. --> 
    </style> 

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

</resources> 

EDIT:

Main Activity Classe:

public class MainActivity extends AppCompatActivity { 

    private Context context; 

    private WebView webView; 
    private LoginDialog dialog; 
    private PinDialog pin; 
    private RelativeLayout mainLayout; 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_main); 

     context = this; 

     ClientCredentials.loadCredentials(context); 

     mainLayout = (RelativeLayout)findViewById(R.id.mainLayout); 
     Button loginButton = (Button)findViewById(R.id.loginButton); 
     webView = (WebView)findViewById(R.id.webview); 
     dialog = new LoginDialog(context); 
     pin = new PinDialog(context, dialog); 

     loginButton.setOnLongClickListener(new View.OnLongClickListener() { 
      @Override 
      public boolean onLongClick(View v) { 
       if(ClientCredentials.getClientId() > 0 && ClientCredentials.getToken().equals("")) { 
        dialog.show(); 
       } 
       else { 
        pin.show(); 
       } 

       return false; 
      } 
     }); 

     pin.setOnDismissListener(new DialogInterface.OnDismissListener() { 
      @Override 
      public void onDismiss(DialogInterface dialog) { 
       loadUrl(); 
      } 
     }); 

     dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { 
      @Override 
      public void onDismiss(DialogInterface dialog) { 
       loadUrl(); 
      } 
     }); 

     webView.setWebChromeClient(new WebChromeClient()); 
     WebSettings webSettings = webView.getSettings(); 
     webSettings.setJavaScriptEnabled(true); 

     if(ClientCredentials.getClientId() > 0 || !ClientCredentials.getToken().equals("")) { 
      loadUrl(); 
     } 
     else { 
      dialog.show(); 
     } 
    } 

    private void loadUrl() { 
     webView.loadUrl(String.format("http://XXX?Address_Id=%d&Token=%s", ClientCredentials.getClientId(), ClientCredentials.getToken())); 
    } 
} 

Ho aggiunto il codice della classe MainActivity per completare la domanda.

risposta

22

styles.xml

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

file di manifesto

android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen" 
+1

deve essere contrassegnato come risolto la questione. funziona perfettamente, grazie! – Ipad

+0

Grazie, lavora per me –