自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(59)
  • 收藏
  • 关注

原创 华为APP审核,权限说明弹窗

【代码】华为APP审核,权限说明弹窗。

2024-08-13 10:11:49 230

原创 Android 使用 GeckoView 并实现 js 交互、权限交互

Android geckoview

2024-04-19 14:00:40 1870 2

原创 安卓 实体类过滤掉指定字段并转为json

【代码】安卓 实体类过滤掉指定字段并转为json。

2023-07-25 16:07:18 462

原创 Android 生成随机数

【代码】Android 生成随机数。

2022-12-28 11:13:22 3266 1

原创 安卓 标题背景使用setAlpha实现渐显渐隐效果

安卓 标题背景使用setAlpha实现渐显渐隐效果

2022-10-13 17:52:30 663

原创 安卓打包 自定义配置apk文件名

安卓打包 自定义配置pak文件名。

2022-10-09 16:03:36 1247

原创 安卓 BottomSheetDialog

仿抖音评论区,可滑动关闭

2022-08-16 11:05:06 658

原创 安卓 一个注解实现防抖

// AOP 配置插件:https://github.com/HujiangTechnology/gradle_plugin_android_aspectjx

2022-08-12 11:18:46 841 1

原创 安卓 滑动实现吸顶效果

只需在xml里即可实现吸顶效果用到的控件:父布局CoordinatorLayout子控件AppBarLayoutXML实现: <androidx.coordinatorlayout.widget.CoordinatorLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <com.google.an

2022-02-08 10:58:52 2991

原创 安卓 保存图片到相册

用到的依赖:加载框: /** * Android仿ios的自定义dialog,loading和toast * 简书:https://www.jianshu.com/p/9259ad7f857b * GitHub:https://github.com/mamumu/mmDialog */ implementation 'com.github.mamumu:mmDialog:1.2.0'权限申请/** * rxPermission * htt

2022-02-08 10:13:52 1580

原创 glide 设置圆角、圆形图片(glide工具类)

import android.content.Context;import android.widget.ImageView;import com.bumptech.glide.Glide;import com.bumptech.glide.load.resource.bitmap.CircleCrop;import com.bumptech.glide.load.resource.bitmap.RoundedCorners;import com.bumptech.glide.request.R

2021-11-18 13:23:36 1127

原创 安卓 点击发送验证码倒计时

自定义类:import android.content.Context;import android.os.CountDownTimer;import android.util.AttributeSet;import androidx.appcompat.widget.AppCompatTextView;import java.util.Locale;public class CountDownView extends AppCompatTextView { public C..

2021-11-16 10:50:55 1994

原创 安卓 清除缓存

1.清除缓存工具类:import android.content.Context;import android.os.Environment;import java.io.File;import java.math.BigDecimal;/** * 缓存 */public class CacheDataManager { public static String getTotalCacheSize(Context context) throws Exception {

2021-11-15 11:23:47 209

原创 安卓 tablayout动态创建fragment

前言:只需要创建一个fragment,并可以实现左右滑动,跟传值给对应的fragment页。xml布局: <com.google.android.material.tabs.TabLayout android:id="@+id/tab_layout" android:layout_width="match_parent" android:layout

2021-09-30 13:46:57 490

原创 recyclerview网格布局平均分放item

先看效果图可以发现分得很均匀,不用在xml里面加入padding或margin了下面是实现方法 分为两步:一、自定义GridDecoration继承RecyclerView.ItemDecorationimport android.graphics.Rect;import android.view.View;import androidx.annotation.IntRange;import androidx.annotation.NonNull;import androidx.re.

2021-09-28 13:41:36 968

原创 // 点击键盘外部,关闭键盘

在baseactivity: @Override public boolean dispatchTouchEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_DOWN) { // 点击键盘外部,关闭键盘 View v = getCurrentFocus(); if (isShouldHideKeyboard(v, ev)) {

2021-07-21 14:28:57 122

原创 安卓 获取焦点自动弹出软键盘

// 获取焦点自动弹出软键盘 public void showSoftInputFromWindow(EditText editText) { editText.setFocusable(true); editText.setFocusableInTouchMode(true); editText.requestFocus(); getWindow().setSoftInputMode(WindowManager.LayoutP...

2021-03-30 15:41:37 265

原创 安卓 闪屏页

在style文件夹里加入: <!-- 闪屏页 --> <style name="LunchTheme" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimaryDark">@color/colorWhite</item> <item name="android:windowBackground">@drawable/sta

2021-03-26 18:02:07 112

原创 安卓 实现 同一代码 打包不同包名 图标以及应用名字

在 build.gradle(:app)里做 以下操作: defaultConfig { applicationId "com.***.**" minSdkVersion 21 targetSdkVersion 28 versionCode 14 versionName "1.2.0" multiDexEnabled true // -----------------------...

2021-02-22 16:36:54 1298 7

原创 SwipeRecyclerView实现侧滑删除(解决删除后不刷新数据)

先放上GitHub地址:https://github.com/yanzhenjie/SwipeRecyclerView效果图就不放了,跟iOS微信的侧滑是类似的效果,可以自定义样式。如何使用:如果你使用的是android support库,那么请添加下述依赖:implementation 'com.yanzhenjie.recyclerview:support:1.3.2'如果你使用的是android x库,那么请添加下述依赖:implementation 'com.yan.

2021-02-05 17:18:48 1004 4

原创 Android 后台下载更新apk并安装适配7.0以上

Android 后台下载更新apk并安装适配7.0以上

2020-12-09 18:09:22 1191

原创 webview 全屏横屏播放视频

参考了这两位大神的博客:android Webview播放视频全屏问题webview播放视频并且点击全屏横屏的方法两个博客的总结:xml需要写两个FrameLayout第一个:放置视频到FrameLayout。(fl_full_video)第二个:webview的父布局。(fl_webview)<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android

2020-12-03 17:35:52 1046

原创 Retrofit动态配置baseUrl

先导入依赖: // RetrofitUrlManager implementation 'me.jessyan:retrofit-url-manager:1.4.0'平常的网络配置: OkHttpClient okHttpClient = new OkHttpClient.Builder() .addInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingIntercep.

2020-12-02 15:52:44 1443

原创 retrofit 请求数组包对象格式

json格式:[{"File_ID":58713,"File_Name":"解师之所惑问育人之道","File_SubName":"解师之所惑问育人之道","File_CategoryDetailID":1756,"File_Order":1,"File_CreateDate":"2020-11-20 18:05:16","Attachment_Path":"https:\/\/video.teacherasked.cn\/image\/20201120\/h6HABNNTt1Ct7y34JeaSjKs6

2020-11-21 14:21:51 268

原创 安卓 DrawerLayout 侧滑菜单

借鉴了这位大神的博客:Android高级UI开发(九)之侧滑菜单 --抽屉布局<?xml version="1.0" encoding="utf-8"?><androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns

2020-11-14 16:55:17 173

原创 安卓 底部导航栏图标凸出

根布局配置:android:clipChildren="false"凸起的布局(需要指定高度)android:layout_gravity="bottom"全部代码:<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.c

2020-11-10 18:26:18 568

原创 安卓 相机相册

定义变量 public static final int RC_TAKE_PHOTO = 1; // 相机 public static final int RC_CHOOSE_PHOTO = 2; // 相册 private String mTempPhotoPath; private Uri imageUri;相机相册 // 相册 private void choosePhoto() { Intent intent

2020-10-31 10:00:11 233

原创 recyclerviewAdapter实现自定义点击事件

Adapter: //第一步 定义接口 public interface OnItemClickListener { void onClick(int user_id); } private OnItemClickListener listener; //第二步, 写一个公共的方法 public void setOnItemClickListener(OnItemClickListener listener) { this.

2020-09-29 14:39:46 853

原创 安卓 动态权限:rxpermissions

导入依赖implementation 'com.github.tbruyelle:rxpermissions:0.10.2'使用方法: /** * 权限申请 - 摄像头、麦克风 */ RxPermissions permissions = new RxPermissions(this); permissions.request(Manifest.permission.CAMERA, Manifest.permissio

2020-09-13 10:44:11 191

原创 安卓 okhttp设置请求头

OkHttpClient okHttpClient = new OkHttpClient.Builder() .addInterceptor(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY)) /** * 添加请求头 给后台做标识 */ ...

2020-09-05 17:34:07 2523

转载 Android 获取手机电量信息

点我跳转到原文章新建一个类继承BroadcastReceiverimport android.content.BroadcastReceiver;import android.content.Context;import android.content.Intent;import android.widget.TextView;public class BatteryReceiver extends BroadcastReceiver { private TextView pow.

2020-09-02 10:38:37 458

原创 recyclerView实现聊天倒序并定位到最后一条

LinearLayoutManager layout = new LinearLayoutManager(this); layout.setStackFromEnd(true); layout.setReverseLayout(true); recyclerViewMsgPull.setLayoutManager(layout);

2020-08-20 15:55:35 1520

转载 直播界面的聊天区域顶部渐变效果

/** *聊天区域顶部的渐变效果 * */ Paint mPaint = new Paint(); // 融合器 final Xfermode xfermode = new PorterDuffXfermode(PorterDuff.Mode.DST_IN); mPaint.setXfermode(xfermode); // 创造一个颜色渐变,作为聊天区顶部效...

2020-08-07 17:47:02 544

原创 安卓 webview 打开微信支付

webView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { // 如下方案可在非微信内部WebView的H5页面中调出微信支付 if (url.startsWith("weixin://wa...

2020-07-04 17:59:54 1018

原创 安卓 再次点击退出应用

private long exitTime; /** * 再次点击退出应用 * * @param keyCode * @param event * @return */ @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && even.

2020-07-01 11:36:44 250

原创 TextView 字体中间加 横划线

原生 TextView 控件 <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:textColor="@color/

2020-06-28 16:22:42 1288

原创 Glide 工具类(圆角、圆形图片)

Glide.with(this) .load(user_headImg) .apply(RequestOptions.bitmapTransform(new CircleCrop())) //设置圆形图片 .into(imgMy);

2020-06-11 18:22:58 596

原创 微信分享-工具类(简单-实用)

前言:本文章里的工具类属于转载 但是原作者的文章地址找不到了 侵权秒删。import android.content.Context;import android.graphics.Bitmap;import android.graphics.BitmapFactory;import android.widget.Toast;import com.tencent.mm.opensdk.modelmsg.SendMessageToWX;import com.tencent.mm.opensdk.

2020-05-30 18:17:03 701

原创 android - TabLayout常用属性、自定义底部指示条、选中字体变大

//TabLayout //noinspection GradleCompatible implementation 'com.android.support:design:28.0.0'

2020-05-27 17:48:30 1332

原创 32位MD5加密工具类 安卓

public class MD5Utils { /** * 32位MD5加密 * @param content -- 待加密内容 * @return */ public static String md5Decode32(String content) { byte[] hash; try { hash = MessageDigest.getInstance("MD5").digest(cont

2020-05-27 12:05:18 241

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除