随笔分类 - Android
摘要:需求 有时会需要改变布局颜色透明度,比如设置控件(如View,Button等)的透明度,有3种方法。 实现方法 java代码实现 text = (TextView) findViewById(R.id.text); text.getBackground().setAlpha(12); setAlph
阅读全文
摘要:支付宝SDK与友盟SDK都有同样的utdid包,所以需要移除其中一个 app的build.gradle中 dependencies { api('com.umeng.umsdk:push:6.4.0') { exclude group: 'com.umeng.umsdk', module: 'utd
阅读全文
摘要:修改前: 修改后: 步骤: 1,定义style:在工程的res/values/styles.xml中添加👇下面配置 <style name="zhuTextStyle" parent="AppTheme.NoActionBar"> <item name="android:colorControlA
阅读全文
摘要:public class ScreenUtils { private ScreenUtils() { throw new AssertionError(); } /** * dp单位转成px * * @param context context * @param dp dp值 * @return p
阅读全文
摘要:/** * 注入的注解,为空,仅起标志作用 */ @Target({ElementType.FIELD}) @Retention(RetentionPolicy.RUNTIME) @interface Inject { } /** * 获取 bean 的容器,必通通过容器获取,而不能使用 new,因
阅读全文
摘要:JS代码中: /* * 打开分享微信弹窗 */ function openDialog () { visible = true; var dialogDom = document.getElementById('dialog') dialogDom.style.display = 'flex' di
阅读全文
摘要:Mac: adb logcat -d >/Users/z/android_log.txt windows: adb logcat -d > c:/b.log
阅读全文
摘要:app.gradle: android { defaultConfig { ... multiDexEnabled true } } dependencies { ... implementation ‘androidx.multidex:multidex:2.0.1’ } MyApplicatio
阅读全文
摘要:https://blog.csdn.net/tu_bingbing/article/details/24143249 public class FramentTest2Activity extends ActionBarActivity { @Override protected void onCr
阅读全文
摘要:https://www.jianshu.com/p/ef6cbf5ade71 方法一:11.25新建的项目 app的build.gradle下面: android { //只需要这样就行了 compileOptions { sourceCompatibility JavaVersion.VERSIO
阅读全文
摘要:https://www.jianshu.com/p/e8c831e9ae73 “强烈推荐fragment的继承类不要去实现带参的构造函数,因为这些带参构造函数在fragment被再次实例化的时候将不会被调用,那么这些参数也就丢失,建议通过setArguments方式进行参数传递。”
阅读全文
摘要:https://blog.csdn.net/zhongshanyishi/article/details/83616293 最近项目上遇到一个问题,页面最外层布局是一个FrameLayout,其内部有两层布局,底层是页面内容布局(可交互部分),上层是缺省布局,用于展示各种异常状况(比如未登录、无网络
阅读全文
摘要:/* * 参考:https://blog.csdn.net/a940659387/article/details/79747479 */ public void setStatusBarWordBlack(Dialog dialog) { Window window = dialog.getWind
阅读全文
摘要:/* * 获取底部栏的高度 */ public int getNavigationHeight(Context context) { if (context == null) { return 0; } if(checkHasNavigationBar(context)){ //这个函数请查看上一片
阅读全文
摘要:https://blog.csdn.net/zhoukongxiao/article/details/84139737 private boolean checkHasNavigationBar(Context context) { boolean hasNavigationBar = false;
阅读全文
摘要:https://blog.csdn.net/m0_37388625/article/details/106025262 纯笔记,无任何高科技,为了软键盘弹出时与输入框保持一点点的距离,使用ScrollView+LinearLayout包裹住输入框,ScrollView+LinearLayout的高度
阅读全文
摘要:https://blog.csdn.net/a940659387/article/details/79747479 /** * Android 6.0 以上设置状态栏颜色 */ protected void setStatusBar(@ColorInt int color) { if (Build.
阅读全文
摘要:第一步:复制下边的Java文件到你的项目 import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Pa
阅读全文
摘要:Glide.with(this) .load(url) .into(new SimpleTarget<Drawable>() { @Override public void onResourceReady(@NonNull Drawable resource, @Nullable Transitio
阅读全文