Android Welcome Screen Maker

Source: Internet
Author: User

Then open the mobile app, the first thing we see is a full screen of the Welcome screen, in this interface display when the entire phone screen will only show this interface, the above title bar, and the top of the mobile phone status bar will disappear, only the Welcome page to the end of the jump to other pages, The title bar and status bar are returned and displayed. Now let's make a welcome interface. Settings for the Welcome screen

First, we need to create an activity to host such a. First find the Layout folder under the Res folder, create an activity to host the Welcome interface, you can also directly take advantage of the created mainactivity, when using other activity, the default access to the interface, You need to change the default mainactivity to the activity on the Welcome screen in the Androidmanifest.xml file. In the activity can be set as the background image of the page, you can also add a ImageView control to display the picture, the background image is unified into the Mipmap folder.

android:background="@mipmap/welcome"  //或者    <ImageView        android:id="@+id/iv_man"        android:layout_width="67dp"        android:layout_height="202dp"        android:layout_alignParentBottom="true"        android:layout_centerHorizontal="true"        android:layout_marginBottom="10dp"        android:background="@drawable/intro_item_manrun_1"        android:visibility="visible" />

After you finish adding the picture, the following is the setting of the title bar and the window disappears. Before Setcontentview (r.layout.activity_main), add some methods to control their disappearance.

//全屏显示,隐藏窗口所有装饰getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);//标题是属于View的,所以窗口所有的修饰部分被隐藏后标题依然有效,需要去掉标题requestWindowFeature(Window.FEATURE_NO_TITLE);

Under normal circumstances requestwindowfeature (Window.feature_no_title) can be effective, but when the activity inherits Appcompatactivity, this fails, but don't worry, There are several ways to solve this problem

//Manually Call Hide () in OnCreateif(Getsupportactionbar() !=NULL){Getsupportactionbar().Hide();}//The second most simple direct use of supportrequestwindowfeature good:supportrequestwindowfeature(Window.Feature_no_title);//Third direct modification of style disadvantage direct global (note inheritance)<style name="Apptheme"Parent="Theme.AppCompat.Light.DarkActionBar"> <!--Customize your theme here. -<item Name="Colorprimary">@color/colorprimary</item> <item name="Colorprimarydark">@color/colorprimarydark</item> <item name="Coloraccent">@color/coloraccent</item> <item name="Android:windowactionbar">false</item> <item name="Android:windownotitle">true</item> </style>
Status bar Set Transparent
if (Build.VERSION.SDK_INT21) {            getWindow().getDecorView();            decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);            getWindow().setStatusBarColor(Color.TRANSPARENT);        }

Android Welcome Screen Maker

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.