GrodView

public void downloadAppURL(final APPOperation operation, LinearLayout layout){
final LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
llayout = (LinearLayout) inflater.inflate(R.layout.app_list, null); //获取对应版块信息
time_navigation = (TextView) llayout.findViewById(R.id.xi_hello_time);
content_navigation = (TextView) llayout.findViewById(R.id.xi_text);
time_navigation.setText(CommonUtil.connect(Parameters.PROJECT_APP_NAME));
content_navigation.setText(Parameters.NETWORK_DOWNLOAD_CLEW);
layout.addView(llayout);
List<APPAttribute> list = operation.getAppList();
if (CommonUtil.isNotEmpty(list)) {
GridView gridView = (GridView)llayout.findViewById(R.id.download_app_list);
ArrayList<HashMap<String, Object>> lstImageItem = new ArrayList<HashMap<String, Object>>();
for (int i = 0; i < list.size(); i++) {
HashMap<String, Object> map = new HashMap<String, Object>();
//map.put("ItemImage", list.get(i).getImg());// 添加图像资源的ID
map.put("ItemImage", R.drawable.icon);
map.put("ItemText", CommonUtil.split(list.get(i).getTitle(),4));// 按序号
lstImageItem.add(map); }
SimpleAdapter saImageItems = new SimpleAdapter(VoiceIdentify.this,
lstImageItem,// 数据来源
R.layout.app_items,// night_item的XML实现
new String[] // 动态数组与ImageItem对应
{ "ItemImage", "ItemText" },
new int[] // ImageItem的XML文件里面的一
{ R.id.ItemImage, R.id.ItemText });
gridView.setAdapter(saImageItems);// 添加并且显示
gridView.setOnItemClickListener(new ItemClickListener()); // 添加消息处理 } }
applist:<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:orientation="vertical">
<TextView android:id="@+id/xi_hello_time"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:gravity="left" android:textSize="12dip" android:paddingLeft="10dip"
android:text="asdasdsd" />
<TextView android:id="@+id/xi_text" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="@string/hello"
android:gravity="left" android:background="@drawable/voice_answer_bg"
android:textSize="17dip" android:paddingLeft="5dip"
android:paddingBottom="25dip" android:textColor="#000"
android:paddingTop="5dip" android:paddingRight="10dip" />
<GridView android:id="@+id/download_app_list"
android:layout_width="fill_parent" android:layout_height="160dip"
android:numColumns="auto_fit" android:verticalSpacing="10dip"
android:horizontalSpacing="10dip" android:columnWidth="90dip"
android:stretchMode="columnWidth" android:gravity="center"></GridView></LinearLayout>
appitem:<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent" android:layout_width="fill_parent"
android:paddingBottom="4dip">
<ImageView android:id="@+id/ItemImage" android:layout_height="wrap_content"
android:src="@drawable/app_pic" android:layout_width="wrap_content"
android:layout_centerHorizontal="true"></ImageView>
<TextView android:id="@+id/ItemText" android:layout_width="wrap_content"
android:layout_below="@+id/ItemImage" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:text="@string/app_title"></TextView></RelativeLayout>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值