- 博客(27)
- 收藏
- 关注
原创 Xbanner轮播(字符串)
依赖implementation 'com.github.xiaohaibin:XBanner:1.6.1'allprojects { repositories { google() jcenter() maven { url 'https://jitpack.io' }}}布局 <com.stx.xhb.xbanner....
2019-04-06 19:32:18 216
原创 Android 6.0动态权限获取相机
设置点击事件判断权限img.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //权限不够 if (ContextCompat.checkSelfPermission(...
2019-04-06 19:11:26 1462
原创 自定义下拉加载
public abstract class OnLoadMoreListener extends RecyclerView.OnScrollListener {private int countItem;private int lastItem;private boolean isScolled = false;//是否可以滑动private RecyclerView.LayoutMana...
2019-03-17 21:17:53 137
原创 Retrofit获取网络数据
ApiService apiService = RetrofitUtils.getInstance().getApiService(MyApi.Url, ApiService.class); Call<List<JsonBean>> news = apiService.getNews(page); news.enqueue(new Callback<L...
2019-03-17 21:15:59 190
原创 Api
Apipublic class Api {//http://gank.io/api/data/%E7%A6%8F%E5%88%A9/10/1public static final String wealUrl ="http://gank.io/api/";//http://www.93.gov.cn/93app/data.do?channelId=1&startNum=1pu...
2019-03-17 21:14:09 138
原创 Retrofit单例
public class RetrofitUtils {private static RetrofitUtils retrofitUtils;private RetrofitUtils() {}public static RetrofitUtils getInstance() { if (retrofitUtils == null) { synchroniz...
2019-03-17 20:47:24 798
原创 js交互
ActivityonCreateView web = view.findViewById(R.id.web); WebSettings settings = web.getSettings(); settings.setJavaScriptEnabled(true); web.loadUrl("file:///android_asset/info.html"); ...
2019-03-04 07:51:41 86
原创 二级联动
效果图Activity FragmentManager manager = getActivity().getSupportFragmentManager(); final FragmentTransaction transaction = manager.beginTransaction(); final LeftFragment left = new LeftFragme...
2019-03-03 21:18:24 169
原创 RecyclerView长按删除
Adapter中添加public interface LongClickLisenter { void LongClickLisenter(int position);}private LongClickLisenter longClickLisenter;public void setLongClickLisenter(LongClickLisenter longClickL...
2019-02-25 20:52:47 1516
原创 解决MVP内存泄漏
Activity需要添加的方法public class MainActivity extends AppCompatActivity implements ShowView {private ShowPresenter presenter;@Overrideprotected void onCreate(Bundle savedInstanceState) { super.on...
2019-02-17 20:50:40 240
原创 OkHttp单例模式、日志拦截器&应用拦截器
public class OkHtpUtils {private static OkHtpUtils okHtpUtils = null;public OkHtpUtils() {}public static OkHtpUtils getInstance() { if (okHtpUtils == null) { //同步锁 synchroniz...
2019-02-17 20:43:22 595
原创 MVP框架
Activitypublic class MainActivity extends AppCompatActivity implements ShowView {private ShowPresenter presenter;@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(s...
2019-02-17 20:42:02 91
转载 手机号验证(正则表达式)
public static boolean isMobileNO(String mobileNums) { /** * 判断字符串是否符合手机号码格式 * 移动号段: 134,135,136,137,138,139,147,150,151,152,157,158,159,170,178,182,183,184,187,188 * 联通号段: 130,131,1...
2019-02-17 20:34:24 1185
原创 无限轮播
布局 <android.support.v4.view.ViewPager android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" /><RadioGroup an...
2019-01-20 11:39:40 105
原创 频道管理
频道管理的app 的build依赖implementation 'com.github.andyoom:draggrid:v1.0.1'项目的build maven { url "https://jitpack.io" }在SDCard中创建与删除文件权限 <uses-permission android:name="android.permission.MOUNT_UNMO...
2019-01-20 11:31:05 148 1
原创 引导页&五秒跳转
public class MainActivity extends BaseActivity { private TextView textview; private SharedPreferences sp;@Overrideprotected int layoutRID() { return R.layout.activity_main;}@Override...
2019-01-16 13:34:47 2444
原创 ImageLoader配置&缓存
依赖 implementation'com.nostra13.universalimageloader:universal-image-loader:1.9.5' 在清单文件中找到创建方法 public class MyApp extends Application { @Override public void onCreate() { super.o...
2019-01-15 19:01:05 272
原创 PullToRefreshlibrary刷新
先导入import之后关联布局 <?xml version="1.0" encoding="utf-8"?><android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="ma...
2019-01-13 19:59:34 179
原创 数据库缓存
创建数据库&表格public class MySQLite extends SQLiteOpenHelper{//创建数据库public MySQLite(Context context) { super(context, "bw.db", null, 1); // TODO Auto-generated constructor stub}//建表@Overridepub...
2019-01-13 19:52:07 102
原创 基类封装
Activitypublic abstract class BaseActivity extends AppCompatActivity {@Overrideprotected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContent...
2019-01-13 19:41:20 236
原创 Fragment的两种实现方法
第一种(FrameLayout):布局<?xml version="1.0" encoding="utf-8"?><android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schem...
2019-01-08 14:52:20 385 1
原创 实现头部导航——TabLayout
效果图布局 &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:
2019-01-08 14:31:19 232
原创 上拉刷新下拉加载&多条目展示
上拉下拉&获取网络数据public class MainActivity extends AppCompatActivity {private XlistView xlv;private Handler handler = new Handler();@Overrideprotected void onCreate(Bundle savedInstanceState) {...
2019-01-06 19:14:14 1164 3
原创 WeekText01
ViewPager布局<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.v4.view.ViewPager ...
2018-12-29 10:42:19 121
原创 检测网络状态以及设置网络
package com.bw.test.activity;import android.content.BroadcastReceiver;import android.content.Context;import android.content.DialogInterface;import android.content.Intent;import android.content.In...
2018-12-28 14:01:19 626
原创 异步,网络判断
package com.bawei.day03text;import android.content.Context;import android.os.AsyncTask;import android.support.v7.app.AppCompatActivity;import android.os.Bundle;import android.util.Log;import and...
2018-12-28 09:24:59 124
原创 Handler获取网络数据
package com.bawei.day02text;import android.annotation.SuppressLint;import android.content.Context;import android.content.Intent;import android.os.Handler;import android.os.Message;import android...
2018-12-28 09:24:13 294
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人