-
android中不错的ExpandableListView实例效果源码
一、ExpandableListView介绍 一个垂直滚动的显示两个级别(Child,Group)列表项的视图,列表项来自ExpandableListAdapter 。组可以单独展开。 1.重要方法 expandGroup(int groupPos) :在分组列表视图中展开一组, setSelectedGroup(int groupPosition) :设置选择指定的组。 setSelectedChild(int groupPosition, int childPosition, boolean shouldExpandGroup) :设置选择指定的子项。 getPackedPositionGroup(long packedPosition) :返回所选择的组 getPackedPositionForChild(int groupPosition, int childPosition) :返回所选择的子项 getPackedPositionType(long packedPosition) :返回所选择项的类型(Child,Group) isGroupExpanded(int groupPosition) :判断此组是否展开 2.代码:ExpandableListContextMenuInfo menuInfo=(ExpandableListContextMenuInfo)item.getMenuInfo();String title=((TextView)menuInfo.targetView).getText().toString();int type=ExpandableListView.getPackedPositionType(menuInfo.packedPosition);if (type==ExpandableListView.PACKED_POSITION_TYPE_CHILD) {int groupPos =ExpandableListView.getPackedPositionGroup(menuInfo.packedPosition);int childPos =ExpandableListView.getPackedPositionChild(menuInfo.packedPosition);二、ExpandableListAdapter 一个接口,将基础数据链接到一个ExpandableListView。此接口的实施将提供访问Child的数据(由组分类),并实例化的Child和Group。 getChildId(int groupPosition, int childPosition) 获取与在给定组给予孩子相关的数据。 getChildrenCount(int groupPosition) 返回在指定Group的Child数目。
- 2013-03-07下载
- 积分:1
-
Android Sensor 各种传感器的使用例子
本源码演示了Android Sensor 各种传感器的使用方法,比较基础的用法,例子中包括了方向传感器、磁场传感器、温度传感器、光传感器和压力传感器的各自调用用法等,相关代码如下:
public void onSensorChanged(SensorEvent event) {
float[] values = event.values;
StringBuffer sb = null;
int type = event.sensor.getType();
switch (type) {
case Sensor.TYPE_ORIENTATION:
sb = new StringBuffer();
sb.append("绕Z:" + values[0])
.append("
绕X:" + values[1])
.append("
绕X:" + values[2]);
ortationEdit.setText(sb.toString());
break;
case Sensor.TYPE_MAGNETIC_FIELD:
sb = new StringBuffer();
sb.append("X方向的角度:" + values[0])
.append("
Y方向的角度:" + values[1])
.append("
Z方向的角度:" + values[2]);
magneticEdit.setText(sb.toString());
break;
case Sensor.TYPE_TEMPERATURE:
sb = new StringBuffer();
sb.append("温度为:" + values[0]);
temeratureEdit.setText(sb.toString());
break;
case Sensor.TYPE_LIGHT:
sb = new StringBuffer();
sb.append("光强为:" + values[0]);
lightEdit.setText(sb.toString());
break;
case Sensor.TYPE_PRESSURE:
sb
- 2022-02-26 07:53:01下载
- 积分:1
-
远程视频监控
【核心代码】 public interface CameraSource { static final String LOG_TAG = "camera"; /** * Open the camera source for subsequent use via calls to capture(). * * @return true if the camera source was successfully opened. */ boolean open(); /** * Close the camera source. Calling close on a closed CameraSource is * permitted but has no effect. The camera source may be reopened after * being closed. */ void close(); /** * The width of the captured image. * * @return the width of the capture in pixels */ int getWidth(); /** * The height of the captured image. * * @return the height of the capture in pixels */ int getHeight(); /** * Attempts to render the current camera view onto the supplied canvas. * The capture will be rendered into the rectangle (0,0,width,height). * Outstanding transformations on the canvas may alter this. * * @param canvas the canvas to which the captured pixel data will be written * @return true iff a frame was successfully written to the canvas */ boolean capture(Canvas canvas); boolean saveImage(String savePath, String fileName); }
- 2013-12-04下载
- 积分:1
-
Bluetooth-LE-Scanner
android蓝牙4.0搜索链接源码,适合初学者学习
- 2023-05-21 05:10:03下载
- 积分:1
-
安卓平台实现zip的解压源码
完整的zip解压实现,可以直接运行,本人亲测,速度还可以的,此提供仅为互相交流和学习,
- 2023-04-05 03:50:04下载
- 积分:1
-
robotium源码
robotium 是 android 自带类 Instrumentation 的一个封装,方便测试人员直接调用封装好的接口,也就是说,实际上我们直接使用Instrumentation 也能够进行自动化测试,但robotium可以简化我们的测试步骤,我们只需要调用某个robotium的API,传几个参数,就等于我们在调用一部分的Instrumentation帮我们实现测试。robotium 就是富二代!!高帅富!!
- 2022-04-20 22:50:28下载
- 积分:1
-
BaiduMapApi_Sample_Android_1.3.3
百度地图的源代码,是android开发所用,适合想研究地图的人看(Baidu map code)
- 2014-02-05 16:35:26下载
- 积分:1
-
android-1.5-SDK
android SDK中文文档,可以帮助你快速进行android编程。(android SDK documentation in Chinese, can help you quickly android programming.)
- 2011-02-16 13:35:07下载
- 积分:1
-
android 多线程实例源码下载
android 多线程实例源码下载
- 2015-05-13下载
- 积分:1
-
android HerilyAlertDialog完全自定义的Dialog
android HerilyAlertDialog完全自定义的Dialog
- 2014-08-21下载
- 积分:1