I want to create a background with an outer frame.

Asked 2 years ago, Updated 2 years ago, 87 views

I set the length and width to matchparent in LinearLayout on the outermost frame of fragment.xml, but it doesn't spread to the whole screen of the device, but it only spreads to the content of the contents.
LinearLayout in activity_main.xml is also set to matchparent.
Please tell me how to expand the screen to the full.

android xml fragment

2022-09-29 22:24

2 Answers

How to expand to the full screen

Change AppCompatActivity to Activity and Remove Title Bar

Change the theme

@android:style/Theme.NoTitleBar

@android:style/Theme.NoTitleBar.Fullscreen

https://akira-watson.com/android/theme-notitlebar.html


2022-09-29 22:24

I don't think the title matches the question.
"I will reply saying ""The application display area does not expand to the entire screen of the device.""""

First, specify a theme that does not have a title bar in XML like the default a.j.w answer, or
Or call the Activity class requestWindowFeature (Window.FEATURE_NO_TITLE) over the java code.

Next, clear the status bar and navigation bar.

View decor=this.getWindow().getDecorView();
clear decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION//Navigation area)
                           | Clear View.SYSTEM_UI_FLAG_FULLSCREEN//Statusbar Area
                           | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); // Set the immediate mode

NaviBar, StatusBar cannot be permanently deleted and will revert with Swipe at the bottom of the screen (Android specification)

If your question is not
The application display area does not expand to the entire screen of the device,
Screenshot of the current problem screen and images of expected behavior,
and layout.xml, etc. I think I can give you an accurate answer.


2022-09-29 22:24

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.