我在Android Studio 1.0 RC 2中工作,我有一个带有Intel HAXM的Android模拟器.模拟器正常运行.它显示硬件按钮,但此按钮不可单击.AVD配置是Nexus S的默认配置,但它的比例为0.5.
我有WebView,我想在WebView中加载页面,在ActionBar中显示进度.该应用程序正在使用AppCompat Android库和应用程序的目标,并且编译SDK版本为21.只是WebView正常运行.
我觉得这个方法有问题setSupportProgress(int progress).
我的代码如下.
活动:
public class AuthActivity extends ActionBarActivity {
private boolean isConfirmationRequired = false;
private Utils utils = new Utils();
@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(Bundle savedInstanceState) {
supportRequestWindowFeature(Window.FEATURE_PROGRESS);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_auth);
final String authUrl = "some url";
final WebView authWebView = (WebView) findViewById(R.id.auth_web_view);
authWebView.getSettings().setJavaScriptEnabled(true);
authWebView.setWebChromeClient(new WebChromeClient() {
@Override
public void onProgressChanged(WebView view, int newProgress) {
setTitle(R.string.loading);
setSupportProgress(newProgress * 100);
if (newProgress == 100)
setTitle(R.string.sign_in);
}
});
authWebView.setWebViewClient(new WebViewClient() {
@Override
public void onPageStarted(WebView view, String url, …Run Code Online (Sandbox Code Playgroud) android webview android-actionbar android-support-library android-actionbaractivity