小编Fer*_*hat的帖子

无法解析方法'findViewById(int)'

我遇到了麻烦,findViewByid但我找不到问题所在.

这是我的FirstFragment班级代码:

import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.ProgressBar;

import java.util.ArrayList;
import java.util.List;


public class FirstFragment extends Fragment {
public static final String TAG = "first";

private WebView mWebView;
ProgressBar progressBar;


@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);


    mWebView = (WebView) findViewById(R.id.activity_main_webview);

    progressBar = (ProgressBar) findViewById(R.id.progressBar1);

    WebSettings webSettings = mWebView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    mWebView.loadUrl("http://www.google.com");
 }

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, …
Run Code Online (Sandbox Code Playgroud)

android findviewbyid

24
推荐指数
3
解决办法
8万
查看次数

标签 统计

android ×1

findviewbyid ×1