41、微信-添加新朋友NewFriendsListActivity
来源:互联网 发布:人工智能电影排名 编辑:程序博客网 时间:2024/04/29 12:11
使用的是通用的activity_listview布局,但是增加了一个列表头:
layout_head = getLayoutInflater().inflate(R.layout.layout_head_newfriend, null);
mlistview.addHeaderView(layout_head);
mlistview.setAdapter(new NewFriendsAdapter(this));
<?xml version="1.0" encoding="utf-8"?>看实现代码:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ebebeb"
android:orientation="vertical" >
<include layout="@layout/layout_head_search"/>
<View
android:background="@color/black2"
android:layout_width="fill_parent"
android:layout_height="1.0dip" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:background="@color/white">
<TextView
android:id="@+id/txt_tel"
android:layout_weight="1"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="12dp"
android:drawableTop="@drawable/a6_"
android:text="添加手机联系人"
android:textColor="#9A9A9A"
android:textSize="14sp" />
<View
android:background="@color/black2"
android:layout_width="1.0dip"
android:layout_height="fill_parent" />
<TextView
android:id="@+id/txt_qq"
android:layout_weight="1"
android:gravity="center"
android:drawableTop="@drawable/a6a"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="12dp"
android:text="添加QQ好友"
android:textColor="#9A9A9A"
android:textSize="14sp" />
</LinearLayout>
<View
android:background="@color/black2"
android:layout_width="fill_parent"
android:layout_height="1.0dip" />
<TextView
android:layout_width="match_parent"
android:layout_height="36dp"
android:gravity="center_vertical"
android:paddingLeft="12dp"
android:text="新的朋友"
android:textSize="12sp" />
</LinearLayout>
public class NewFriendsListActivity extends BaseActivity implements
View.OnClickListener {
private TextView txt_title, txt_right;
private ImageView img_back;
private ListView mlistview;
private View layout_head;
@Override
public void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_listview);
super.onCreate(savedInstanceState);
}
@Override
protected void initControl() {
txt_title = (TextView) findViewById(R.id.txt_title);
txt_title.setText("新的朋友");
txt_right = (TextView) findViewById(R.id.txt_right);
txt_right.setText("添加朋友");
img_back = (ImageView) findViewById(R.id.img_back);
img_back.setVisibility(View.VISIBLE);
mlistview = (ListView) findViewById(R.id.listview);
layout_head = getLayoutInflater().inflate(R.layout.layout_head_newfriend, null);
mlistview.addHeaderView(layout_head);
mlistview.setAdapter(new NewFriendsAdapter(this));
}
@Override
protected void initView() {
}
@Override
protected void initData() {
}
@Override
protected void setListener() {
img_back.setOnClickListener(this);
txt_right.setOnClickListener(this);
layout_head.findViewById(R.id.txt_search).setOnClickListener(this);
layout_head.findViewById(R.id.txt_tel).setOnClickListener(this);
layout_head.findViewById(R.id.txt_qq).setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.img_back:
Utils.finish(NewFriendsListActivity.this);
break;
case R.id.txt_right:
Utils.start_Activity(this, PublicActivity.class, new BasicNameValuePair(Constants.NAME, "添加朋友"));
break;
case R.id.txt_search:
Utils.start_Activity(this, PublicActivity.class, new BasicNameValuePair(Constants.NAME, "搜索"));
break;
case R.id.txt_tel:
Utils.start_Activity(this, AddFromContactActivity.class);
break;
case R.id.txt_qq:
Utils.start_Activity(this, PublicActivity.class, new BasicNameValuePair(Constants.NAME, "添加QQ好友"));
break;
default:
break;
}
}
}
0 0
- 41、微信-添加新朋友NewFriendsListActivity
- 42、微信-添加新朋友列表适配器
- 新朋友
- 新朋友
- 新朋友
- 如何在微信朋友圈内分享
- 微信朋友如何互动起来
- 微信朋友如何互动起来
- android 微信朋友分享,朋友圈分享
- android 微信朋友接入步骤
- 类似微信朋友圈点赞评论
- 仿照微信朋友缩略图实现
- 关于微信接口--发送给朋友
- 微信jssdk转发朋友和朋友圈
- 微信分享朋友,朋友圈,qq
- 微信分享到朋友或朋友圈
- PHP实现 微信--分享朋友链接
- 微信开发(三)微信分享朋友朋友圈
- 新开始
- 40、微信-搜索好友及公众号页面SearchActivity
- IE8以下的attachEvent()和其他浏览器的addEventListener()区别
- 算法题--答案仅供参考
- HTTP Status 404 - No result defined for action解决方法
- 41、微信-添加新朋友NewFriendsListActivity
- 选择文本触发事件
- RTSP消息详解
- 快速定位crash的炫酷方式
- 时间戳的格式,直接影响时间戳的正确与否
- 42、微信-添加新朋友列表适配器
- Linux常用命令
- dimension适配
- UICollectionViewLayout