package com.mycompany.application;
import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MainActivity extends Activity {
private String[] Title={"【原创技术】修改处理器","【原创技术】GG修改身份证号码","【原创技术】修改银行卡余额","【实用分享】水卡破解之路!","【实用分享】如何变成爸爸","【实用分享】嘎嘎嘎嘎嘎","【实用分享】哦哦哦哦哦哦哦","【实用分享】哥哥哥哥个"};
private String[] Content={"卧槽放心吧这是假的","有这麽牛逼???","算了吧,要背抓","这个倒是可以有哈哈哈哈哈","【实用分享】水卡破解之路!","【实用分享】水卡破解之路!","【实用分享】水卡破解之路!","【实用分享】水卡破解之路!"};
private String[] Seanumber={"1255","1228","3555888","855","81","833","8228","86688"};
private String[] Writenumber={"12","10","3555","1","880","28","18","83"};
private String[] Byer={"妖怪","后视镜","幺儿豁","爱奴的抱抱","我是你爹","狗子你变了","哈哈哈哈","阿夜"};
List<Map<String,Object>> list=new ArrayList<Map<String, Object>>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
for(int i=0;i<Title.length;i++){
Map<String,Object> map=new HashMap<String, Object>();
map.put("title",Title[i]);
map.put("conten",Content[i]);
map.put("seanumber",Seanumber[i]);
map.put("writenumber",Writenumber[i]);
map.put("byer",Byer[i]);
list.add(map);
}
ListView listview=this.findViewById(R.id.listView);
listview.setAdapter(new MyAdapter());
}
class MyAdapter extends BaseAdapter {
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int position) {
return list.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view;
ViewHolder mHolder;
if(convertView==null){
view= LayoutInflater.from(MainActivity.this).inflate(R.layout.List_card,null);
mHolder=new ViewHolder();
mHolder.card_title=view.findViewById(R.id.cardTitle);
mHolder.card_content=view.findViewById(R.id.ListcardTextContent);
mHolder.card_seanumber=view.findViewById(R.id.ListcardTextSeanumber);
mHolder.card_writenumber=view.findViewById(R.id.ListcardTextwritenumber);
mHolder.card_byer=view.findViewById(R.id.ListcardTextByer);
view.setTag(mHolder);
}else {
view=convertView;
mHolder=(ViewHolder)view.getTag();
}
mHolder.card_title.setText(list.get(position).get("title").toString());
mHolder.card_content.setText(list.get(position).get("conten").toString());
mHolder.card_seanumber.setText(list.get(position).get("seanumber").toString());
mHolder.card_writenumber.setText(list.get(position).get("writenumber").toString());
mHolder.card_byer.setText(list.get(position).get("byer").toString());
return view;
}
}
class ViewHolder{
TextView card_seanumber;
TextView card_writenumber;
TextView card_title;
TextView card_content;
TextView card_byer;
}
}
|