Reputation: 60
I have a problem with the background image of my login activity. I can't remove the white bar at the top of the background image... Someone can help me?
In preview:
In my smartphone:
Here is my Relative Layout code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/login_background"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.project.main.application.view.activity.Av_Login">
Upvotes: 0
Views: 391
Reputation: 6857
There is one more solution, but API level 19 is the limitation as well,
windowTranslucentStatus
property.
style(v19)
<!-- Considering AppTheme as your app's theme -->
<style name="AppTheme.Trans" parent="AppTheme">
<item name="android:windowTranslucentStatus">true</item>
</style>
Now apply that theme to your <activity>
element in manifest
<activity
android:name=".ui.login.SplashActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.Trans"
android:windowSoftInputMode="adjustResize|stateHidden" />
Upvotes: 0
Reputation: 267
add Main Activity in onCreate before setContentView();
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
manifest activity add fullscreen theme
<activity android:name=".MainActivty"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
Upvotes: 0
Reputation: 1302
The status bar color matches to the colorPrimaryDark in your styles.xml (white in your case).
If you want to change this read this answer : How to change the status bar color in android
Upvotes: 0
Reputation: 1277
Add below line of code
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < MINIMUM_API_LEVEL) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else {
getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_FULLSCREEN);
}
Upvotes: 1