1.在主页面(activity引用Fragment )的布局文件中定义FrameLayout ,加载Fragment  <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/fl_content" android:layout…
xUtils的BitmapUtils模块用的就是三级缓存,在项目中尽量还是应用BitmapUtils 三级缓存(机制) import com.itheima.zhsh66.R; import android.graphics.Bitmap; import android.widget.ImageView; /** * 三级缓存工具类 * */ public class MyBitmapUtils { // 网络缓存工具类 private NetCacheUtils mNetUtils; // 本…
1.ViewPagerIndicator https://github.com/JakeWharton/ViewPagerIndicator package com.viewpagerindicator.sample; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.…
语音识别:科大讯飞语音云 http://www.xfyun.cn/ 语音机器人模拟 public class TalkBean { public String text; public boolean isAsk;// true表示提问,false是回答 public int imageId = -1;// 回答的图片id public TalkBean(String text, boolean isAsk, int imageId) { this.text = text; this.isAsk…
1.图片适配 放入相同名称的资源文件,机器根据不同分辨率找相近的资源 240*320 ldpi 320*480 mdpi 480*800 hdpi 720*1280 xhdpi 2.布局适配 在不同的分辨率下显示不同的布局,定义不同分辨率的布局文件,一般控件相同(否则FindViewByID找不到) layout-800x480,  适配480*800分辨率的布局 3.尺寸适配 dp 设备独立像素 dp = px / 设备密度 float density = getResources().get…
ListView.GridView显示组图,处理机制相同 <?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="w…
广告轮播条播放 if (mHandler == null) {//在此初始化mHandler , 保证消息不重复发送 mHandler = new Handler() { public void handleMessage(android.os.Message msg) { int currentItem = mViewPager.getCurrentItem(); if (currentItem < mTopNewsList.size() - 1) { currentItem++; } els…
1.布局文件 <?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" andr…
1.因为给LISTVIEW增加了两个头布局,所以在点击事件ITEM索引会增加2,比如原来第一条数据的索引应该为0,增加两个头布局后,它的索引变为        2,为了使LISTVIEW的ITEM在点击时索引不变,实现以下方法 2.实现接口android.widget.AdapterView.OnItemClickListener 3.重写setOnItemClickListener  onItemClick方法 private OnItemClickListener mItemClickLis…
1.ListView加脚布局 头布局initHeaderView,在onTouchEvent事件中进行显示隐藏头布局切换 脚布局initFooterView,实现接口OnScrollListener,重写接口方法onScrollStateChanged   onScroll    进行显示隐藏脚布局切换 添加标记isLoadingMore,是否正在加载数据,防止多次滑动重复加载数据 <?xml version="1.0" encoding="utf-8"?&g…