然后
package com.test.HelloGridView;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
public class HelloGridView extends Activity
{
public void onCreate(Bundle savedInstanceState)
{
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView tv = (TextView)this.findViewById(R.id.myTitleBarTextView);
tv.setBackgroundColor(0xFF848284);
tv.setTextColor(0xFFFFFFFF);
Button toggleTitleButton = (Button)this.findViewById(R.id.toggle_title_button);
toggleTitleButton.setOnClickListener( new OnClickListener()
{
@Override
public void onClick(View v)
{
LinearLayout ll = (LinearLayout)findViewById(R.id.myTitleBarLayout);
if(ll.getVisibility() == View.GONE)
{
ll.setVisibility(View.VISIBLE);
}
else
{
ll.setVisibility(View.GONE);
}
}
});
}
}
有时候也可以
通过
private void updateFullscreenStatus(bUseFullscreen)
{
if(bUseFullscreen)
{
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
}
else
{
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
m_contentView.requestLayout();
}
通过两种方法 就可以去掉状态栏和标题栏了这个用在游戏中比较好.,上述方法是通过标题栏实现的
3.通过主题实现隐藏状态栏和标题栏
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
机房租用,北京机房租用,IDC机房托管, http://www.fwqtg.net
相关推荐: 一图看懂CodeArts Deploy 5大特性,带你玩转部署服务
华为云持续部署服务CodeArts Deploy,通过模块化自由编排部署流程,实现软件的自动化部署,基于其易入门、功能全、集成度高、自动化、可靠的部署能力,能够帮您快速实现业务上云,全面提升软件的交付效率,显著提升交付质量! 产品详情地址:部署CodeArt…