this question has answer here:
- fullscreen activity in android? 19 answers
i not able make fullscreen android app. though mainactivity not show notification bar, keeps area of notification bar empty... padded white row height of notification bar. appreciated. here manifest file.
<application android:allowbackup="true" ... android:theme="@style/apptheme"> <activity android:name=".mainactivity" android:label="@string/app_name" android:screenorientation="landscape" android:theme="@style/apptheme.noactionbar"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name=".loginactivity" android:screenorientation="landscape" android:label="@string/title_activity_login"></activity> </application>
if make modification
<activity android:name=".activityname" android:label="@string/app_name" android:theme="@android:style/theme.notitlebar.fullscreen"/>
then crashes app, though app gets compiled.
update more detail. error when app crashes is:
**java.lang.runtimeexception: unable start activity componentinfo{com.example.vibha.digits42c/com.example.vibha.digits42c.mainactivity}: java.lang.illegalstateexception: need use theme.appcompat theme (or descendant) activity.** @ android.app.activitythread.performlaunchactivity(activitythread.java:2416) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2476) @ android.app.activitythread.-wrap11(activitythread.java) @ android.app.activitythread$h.handlemessage(activitythread.java:1344) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:148) @ android.app.activitythread.main(activitythread.java:5417) @ java.lang.reflect.method.invoke(native method) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:726) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:616) **caused by: java.lang.illegalstateexception: need use theme.appcompat theme (or descendant) activity.** @ android.support.v7.app.appcompatdelegateimplv7.createsubdecor(appcompatdelegateimplv7.java:310) @ android.support.v7.app.appcompatdelegateimplv7.ensuresubdecor(appcompatdelegateimplv7.java:279) @ android.support.v7.app.appcompatdelegateimplv7.setcontentview(appcompatdelegateimplv7.java:253) @ android.support.v7.app.appcompatactivity.setcontentview(appcompatactivity.java:109) @ com.example.vib.digits42c.mainactivity.oncreate(mainactivity.java:45)
now @ last line @ mainactivity.java:45
, code is
setcontentview(r.layout.activity_main);
i targeting @ nexus 5, android 6.0.1
instead of
android:theme="@style/apptheme.noactionbar">
try use:
android:theme="@android:style/theme.notitlebar.fullscreen">
hope work
edit: java class extends activity
, should appcompatactivity
change it
Comments
Post a Comment