[英]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.