我正在尝试从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文件内容请搜索靠谱客的其他文章。
发表评论 取消回复