Skip to content Skip to sidebar Skip to footer

Android Image Fullscreen

i write this XML code for my maiActivity:

Solution 1:

You can do this in tow ways:

1- Pragmatically

public class YoutActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // remove titlerequestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_main);
    }
}

2- XML: you can set it up in the AndroidManifest.xml

<activity android:name=".YoutActivity "
    android:label="@string/app_name"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>

that will let also the image full the screen as u set the bound

Solution 2:

If you want to get image as your background you don't need to use Imageview.

Use android:background="@drawable/back" in relative layout declaration ;)

Solution 3:

One option is to change the layout to FrameLayout and add these attributes to the ImageView:

android:src="@drawable/your_image"android:scaleType = "centerCrop"

Solution 4:

Try this:

Layout

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:fitsSystemWindows="true"
    android:background="#ffffff"
    tools:context="com.smbds.app.activities.SplashScreenActivity">

    <ImageView
        android:src="@drawable/ic_branding_splashscreen"
        android:layout_centerInParent="true"
        android:keepScreenOn="true"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

Activity

@OverrideprotectedvoidonCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_splash_screen);

    resources = getResources();

Post a Comment for "Android Image Fullscreen"