0

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:

enter image description here

In my smartphone:

enter image description here

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">

4 Answers4

1

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);
        }
Aslam Hossin
  • 926
  • 9
  • 21
  • 1
    Your condition doesn't work but i change to: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) and it works, THANK YOU!!! – Marco Rosário Mar 04 '17 at 12:01
0

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"/>
Roma Darvish
  • 247
  • 5
  • 19
0

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

Community
  • 1
  • 1
BenjaminBihr
  • 1,082
  • 2
  • 9
  • 15
0

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" />
Paresh P.
  • 5,913
  • 1
  • 11
  • 23