我是靠谱客的博主 土豪羊,这篇文章主要介绍assets文件夹读取html权限,从assets文件夹加载本地html文件的问题,现在分享给大家,希望可以做个参考。

我正在尝试从listview项目上的assets文件夹加载html文件。

问题是,点击它会显示干净的页面,检查html文件。

这是一段代码。

public static ListView listview;

public static ArrayList interviews;

public static ArrayAdapter adapter;

public WebView myWebView;

@Override

protected void onCreate(Bundle savedInstanceState)

{

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_kochergin);

listview = (ListView) findViewById(R.id.mainListView);

myWebView = (WebView)findViewById(R.id.webview);

// myWebView = new WebView(this);

listview.setBackgroundColor(Color.BLACK);

listview.setCacheColorHint(Color.BLACK);

String[] interviewlist = new String[] {"Interview1", "Interview2","Interview3","Interview4","Interview5","Interview6"};

ArrayList interviews = new ArrayList();

interviews.addAll( Arrays.asList(interviewlist) );

ArrayAdapter adapter = new ArrayAdapter(this, R.layout.simplerow, R.id.rowTextView, interviews);

listview.setAdapter(adapter);

Collections.sort(interviews);

listview.setOnItemClickListener(new OnItemClickListener()

{

@Override

public void onItemClick(AdapterView> arg0, View arg1, int arg2, long arg3)

{

setContentView(R.layout.webview);

// myWebView.setVisibility(View.VISIBLE);

// myWebView.getSettings().setJavaScriptEnabled(true);

myWebView.loadUrl("file:///android_asset/2.html");

}

});

我做错了什么?

最后

以上就是土豪羊最近收集整理的关于assets文件夹读取html权限,从assets文件夹加载本地html文件的问题的全部内容,更多相关assets文件夹读取html权限,从assets文件夹加载本地html文件内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(57)

评论列表共有 0 条评论

立即
投稿
返回
顶部