简体   繁体   English

如何在android中隐藏我的应用程序窗口?

[英]How to hide my application window in android?

How to hide my application window through programmatically? 如何通过编程隐藏我的应用程序窗口?

Is it possible? 可能吗?

setContentView( R.layout.screen1 );

This coding to start application window. 此编码启动应用程序窗口。 How to hide this window. 如何隐藏此窗口。 Is it possible? 可能吗?

Thanks. 谢谢。

Try with this, 试试这个

MainActivity.java MainActivity.java

        public class MainActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        // Put you code to hide the layout
        RelativeLayout mLayout = (RelativeLayout) findViewById(R.id.mainLayout);
        mLayout.setVisibility(View.GONE);
    }
}

activity_main.xml activity_main.xml中

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/mainLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="96dp"
        android:text="Button" />

</RelativeLayout>

Yeah its possible. 是的,有可能。 Provide an id to the parent window of screen1 layout like: 为screen1布局的父窗口提供一个ID,例如:

android:id="@+id/main_layout"

and when you want to hide it, write something like: 而当您想要隐藏它时,请写类似以下内容:

final LinearLayout mainLayout = (LinearLayout)findViewById(R.layout.main_layout); // assuming its a LinearLayout

mainLayout.setVisibility(View.GONE);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何隐藏Android应用程序工具栏中的搜索栏? - How to hide the search bar in the toolbar of my Android application? 如何在没有root设备的情况下隐藏Android设备中的任何应用程序? - How to hide any application in android device without rooting my device? 如何从我的启动器Android隐藏应用程序图标 - How To hide application icon from my launcher android 如何从我的Android应用程序隐藏Android桌面上的其他应用程序快捷方式图标 - How to hide other application Shortcut icons on android desktop from my android application 如何在Android中隐藏应用程序标题? - How to hide application title in Android? 在我的Android应用程序中隐藏底部的导航面板? - Hide the bottom Navigation Panel in my application in Android? Android界面按钮隐藏了我应用程序的底部 - Android Interface Buttons hide the bottom of my application 如何仅针对Android Tabs2和Android version4.0.3上的应用程序隐藏android状态栏? - How to hide android status bar just for my application on Android Tabs2 fro Android version4.0.3? 如何从应用程序列表中隐藏我的应用程序中的其他应用程序 - how to hide other application from my application from list of apps android 如何在android中隐藏Intent Chooser窗口? - How to hide the Intent Chooser window in android?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM