即时聊天社交软件(二)
来源:互联网 发布:淘宝家具安装价格 编辑:程序博客网 时间:2024/05/01 20:59
即时聊天社交软件(二)
这次做一些关于android控件的设置
当用户登陆成功后的界面设置 :
我打算将这个activity设置成有下拉刷新和左菜单栏功能的activity
1. 下拉刷新控件 :
使用pulltorefresh控件 可以自行百度导入
2.左侧菜单栏 :
使用drawerlayout布局:
下面是布局文件:
<?xml version="1.0" encoding="utf-8"?><android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/draw_layout" android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <com.handmark.pulltorefresh.library.PullToRefreshListView android:id="@+id/mylv" android:layout_width="fill_parent" android:layout_height="fill_parent" > </com.handmark.pulltorefresh.library.PullToRefreshListView> </LinearLayout> <!-- 侧拉视图 --> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="#fff" android:layout_gravity="start"> <ListView android:id="@+id/lv1" android:layout_width="match_parent" android:layout_height="match_parent" android:divider="@null" android:text="DrawerLayout" /> </LinearLayout></android.support.v4.widget.DrawerLayout>
下面是java文件:
package com.ws.talk;import java.util.ArrayList;import com.example.qq.R;import com.handmark.pulltorefresh.extras.viewpager.PullToRefreshViewPager;import com.handmark.pulltorefresh.library.PullToRefreshListView;import android.app.Activity;import android.os.Bundle;import android.support.v4.widget.DrawerLayout;import android.view.View;import android.widget.ArrayAdapter;import android.widget.ListView;public class talk extends Activity { PullToRefreshListView lv; private ArrayAdapter<String> adapter; private DrawerLayout drawerLayout; private ListView lv1; private ArrayList<String>arrayList; private ArrayAdapter<String> ad1; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.talk); lv = (PullToRefreshListView) findViewById(R.id.mylv);//下拉刷新控件 adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, new String[] { "a", "b", "c" });//下拉刷新的适配器 lv.setAdapter(adapter);//开始 drawerLayout=(DrawerLayout) findViewById(R.id.draw_layout);//左侧菜单栏控件 lv1=(ListView) findViewById(R.id.lv1); arrayList=new ArrayList<String>(); for (int i = 0; i < 5; i++) { arrayList.add("自定义"+i); } ad1=new ArrayAdapter<String>(talk.this,android.R.layout.simple_list_item_1,arrayList); //simple_list_item_1不能用simple_list_item_2替换 这个问题百度了好久 结果就是自作聪明换成了item2 lv1.setAdapter(ad1);//给listview设置adapter }}
我这里基本都给出了注释,请仔细查看
下面是我分享的pull to refresh 的包 直接导入就可以了
http://yun.baidu.com/share/link?shareid=246519337&uk=1311862808
0 0
- 即时聊天社交软件(二)
- 即时聊天社交软件 (一)
- QT 即时聊天软件(一)
- 即时聊天软件开发体会
- Android即时智能聊天软件
- 融云(即时聊天)
- Whoere即时聊天App(二)本地开发
- 即时聊天软件与开放平台
- 基于Bmob的仿微信即时聊天软件
- 即时引爆社交红利2.0(读书笔记)
- 即时聊天
- (二十)即时通信的聊天气泡的实现I
- (二十一)即时通信的聊天气泡的实现II
- #征文再续#Android基于XMPP Smack Openfire开发IM即时聊天(二)
- Android即时通讯--仿QQ即时聊天:(二)闪屏页及登录页面的实现
- Android--使用融云SDK开发即时聊天(二)----设置单聊
- Android基于环信SDK开发IM即时聊天(二)
- 万能的便携即时聊天软件-Pidgin Portable
- 转:tslib1.4 移植全过程
- 2014总结
- bzoj 1070: [SCOI2007]修车
- iOS开发之OC和C混编问题
- php之文件载入include, include_once,require,require_once
- 即时聊天社交软件(二)
- kernel里如何打开文件并打印出error
- MFC采用MSComm控件通信时,出现error LNK2001:无法解析的外部符号问题的解决方法
- ★hdu--1429(好题--二进制压缩)
- C++十进制转换为二进制
- Linux
- CentOS中利用C语言操作MySQL,插入日期和时间
- 2016年阿里实习5面面经
- poj1061 青蛙的约会(扩展欧几里得)