Android在进度条加载完成后隐藏标题栏
我试图在进度条加载完毕后隐藏标题栏。有人能告诉我怎么做吗?谢谢Android在进度条加载完成后隐藏标题栏,android,progress-bar,titlebar,android-titlebar,Android,Progress Bar,Titlebar,Android Titlebar,我试图在进度条加载完毕后隐藏标题栏。有人能告诉我怎么做吗?谢谢 @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //this.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); **//Putting this make the whole title bar
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//this.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); **//Putting this make the whole title bar hidden**
this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
this.getWindow().requestFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.main);
一堆代码
webView.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress)
{
//Make the bar disappear after URL is loaded, and changes string to Loading...
MyActivity.setTitle("Loading...");
MyActivity.setProgress(progress * 100); //Make the bar disappear after URL is loaded
// Return the app name after finish loading
if(progress == 100)
this.requestWindowFeature(Window.FEATURE_NO_TITLE);**//Not Working (shows Error The method requestWindowFeature(int) is undefined for the type new WebChromeClient(){} )**
//MyActivity.setTitle(R.string.app_name);
}
});
webView.setWebViewClient(new InsideWebViewClient());
}
您需要将以下语法写入AndroidManifest.xml文件
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
如果您想通过在Activity中编码来实现,那么可以在Activity的OnCreate()方法中使用以下代码
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
谢谢路西法的回复。但这样做将隐藏我的进度条,使其无法显示在标题栏上。在webview完成加载后,是否有其他选项可以显示进度栏并隐藏标题栏?我在实现代码AndroidRuntimeException:requestFeature()时遇到此错误,必须在添加内容之前调用