当前位置: 代码迷 >> Android >> Android仿新浪微博的“更多”页面效果
  详细解决方案

Android仿新浪微博的“更多”页面效果

热度:73   发布时间:2016-05-01 20:40:56.0
【原创】Android仿新浪微博的“更多”页面效果
看到新浪微博那个“更多”页面的效果,感觉不错,所以拿来模仿一下,其实实现就是一个listview,再加上一些图片:

直接上代码,首先是Activity

[code="java"]public class MoreActivity extends Activity {

ListView listView;

@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.moreitems);
String[] texts = { getResources().getString(R.string.menu_settings),
getResources().getString(R.string.weibo_account_manage),
getResources().getString(R.string.weibo_readmode),
getResources().getString(R.string.skin_list),
getResources().getString(R.string.weibo_officialweibo),
getResources().getString(R.string.weibo_feedback),
getResources().getString(R.string.weibo_check_update),
getResources().getString(R.string.weibo_about),
getResources().getString(R.string.back) };
int[] resIds = { R.drawable.moreitems_setting_icon,
R.drawable.moreitems_accountmanage_icon,
R.drawable.readmode_icon, R.drawable.skin_def_icon,
R.drawable.moreitems_officialweibo_icon,
R.drawable.moreitems_feedback_icon,
R.drawable.moreitems_version, R.drawable.aboutweibo,
R.drawable.aboutweibo };
listView = (ListView) findViewById(R.id.moreItemsListView);
listView.setAdapter(new ListViewAdapter(texts, resIds));
listView.setDivider(getResources().getDrawable(
R.drawable.moreitem_bg_line));
}

public class ListViewAdapter extends BaseAdapter {
View[] itemViews;

public ListViewAdapter(String[] itemTexts, int[] itemImageRes) {
itemViews = new View[itemTexts.length];

for (int i = 0; i







然后是itemiew的xml文件

[code="xml"]






图片可以从新浪微博那里获得,最终效果如下图:

[img]http://my.iteye.com/admin/picture/113297" alt="[/img]


[img]http://my.iteye.com/admin/picture/113297" alt="[/img]

  相关解决方案