我想创建一个类似Facebook的新闻源的应用程序它将成为一个文本下方的图像,打开一个新的页面,但我实际上不知道它是什么,所以我无法搜索互联网我不知道它是什么名字,所以如果有人能告诉我它叫什么或者如何制作像Facebook这样的新闻提要或者这个想法的教程。如何制作像android的新闻提要?
3
A
回答
9
这基本上是一个ListView和ListAdapter。
您必须根据需要更改默认的ListView布局。
根据您的要求,达到Facebook的布局,你可以按照这个资源链接,帮助
http://www.androidhive.info/2014/06/android-facebook-like-custom-listview-feed-using-volley/
3
您必须阅读关于ListView
和ListAdapter
。根据他们的解决方案。
0
我给你一个选择,而第一步。您可以通过JSON使用请求来搜索存储在Web上的文本和图像。
// DownloadJSON AsyncTask
private class DownloadJSON extends AsyncTask<Void, Void, Void> {
@Override
protected void onPreExecute() {
super.onPreExecute();
// Create a progressdialog
mProgressDialog = new ProgressDialog(MainActivity.this);
// Set progressdialog title
mProgressDialog.setTitle("Your app");
// Set progressdialog message
mProgressDialog.setMessage("Loading...");
mProgressDialog.setIndeterminate(false);
// Show progressdialog
mProgressDialog.show();
}
@Override
protected Void doInBackground(Void... params) {
// Create an array
arraylist = new ArrayList<HashMap<String, String>>();
// Retrieve JSON Objects from the given URL address
jsonobject = JSONfunctions
.getJSONfromURL("YOUR_PATH_URL_CONECT.PHP");
try {
// Locate the array name in JSON
jsonarray = jsonobject.getJSONArray("value");
for (int i = 0; i < jsonarray.length(); i++) {
HashMap<String, String> map = new HashMap<String, String>();
jsonobject = jsonarray.getJSONObject(i);
// Retrive JSON Objects
map.put("thumbImage", jsonobject.getString("thumbImage"));
map.put("title", jsonobject.getString("title"));
// Set the JSON Objects into the array
arraylist.add(map);
}
} catch (JSONException e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void args) {
// Locate the listview in listview_main.xml
listview = (ListView) findViewById(R.id.listview);
// Pass the results into ListViewAdapter.java
adapter = new ListViewAdapter(MainActivity.this, arraylist);
// Set the adapter to the ListView
listview.setAdapter(adapter);
// Close the progressdialog
mProgressDialog.dismiss();
return;
}
}
YOUR_PATH_URL_CONECT.PHP
echo '{"value":'.json_encode($yourArrayJsonObject).'}';
现在做创建适配器的其余部分。
相关问题
- 1. Android新闻提要
- 2. 如何自动刷新新闻提要像Facebook的作品?
- 3. 制作网页切换新闻提要
- 4. Facebook API新闻提要Android
- 5. 新闻提要API的一般新闻
- 6. 如何自动刷新新闻提要
- 7. 如何更新网页内容像facebook新闻提要更新
- 8. 如何获得新闻提要?就像新闻和天气应用程序
- 9. 如何处理TFL新闻提要?
- 10. android造型定制阵列适配器的新闻提要
- 11. 如何在Android中访问Facebook的新闻提要部分?
- 12. Ruby/Rails新闻提要?
- 13. 状态/新闻提要?
- 14. 如何在android上使用phonegap获取facebook新闻提要?
- 15. 如何制作新闻网站新闻可搜索
- 16. 新闻提要自动刷新jquery
- 17. iOS UIKit控制器提供照片新闻提要
- 18. DNN新闻提要中的System.Xml.Xsl.XslLoadException
- 19. 阅读非朋友的新闻提要
- 20. 如何在android上制作滚动新闻横幅?
- 21. 将图像添加到网站上的facebook新闻提要
- 22. 如何实施像哈佛和CNN应用程序的新闻提要?
- 23. Android上的Facebook新闻提要阅读器
- 24. Marque Rss新闻提要里面我的android应用程序
- 25. 限制页面新闻提要抓JUST页面的帖子
- 26. 如何获取iOS的Facebook新闻提要(粉丝页面)?
- 27. 如何找到特定新闻源的提要或XML
- 28. 如何通过图形API获取用户的新闻提要
- 29. 在facebook上发布新闻提要
- 30. Ios 6新闻提要(隐藏页面)
非常感谢:) – 2014-12-04 12:50:37