这个不怎么用,一直找不到方法,最后发现是放在 Typeface 里,提醒一下有需要的朋友
textView.setTypeface(Typeface.DEFAULT_BOLD);
实例化布局,同其他布局一样,new 一个根布局出来用来放置控件。控件的定位和约束控制需要借助 `ConstraintLayout.LayoutParams` 来设置,在设置约束时,要知道所参考的控件的 ID 值,如果是自定义的控件,记得给控件加上 `setId()` 。定位参考父布局,首先要拿到根布局的ID值,在xml中我们直接使用 parent 在代码里,也有相对应的ID值`ConstraintLayout.LayoutParams.PARENT_ID`。
发生场景:mapper层方法传2个参数,默认一个参数可以不需要@Param,但传多个参数必须指定@Param(“别名”)
说明:该问题出错在mapper层与xml层的参数设置问题
文章目录第一种情况:mapper层方法缺少@Param注解第二种情况:传2个参数都是对象的时候,而不是简单地string、int等等
第一种情况:mapper层方法缺少@Param注解
第二种情况:传2个参数都是对象的时候,而不是简单地string、int等等
出错原因:对象具体的xx属性没加对象名
出错代码:
正确代码:
public abstract class BaseDialog extends Dialog {
protected ConstraintLayout mRootView;
protected View mContentView;
private boolean mT...
一般来说,做android开发,用xml布局比较多,相对于用代码来布局还是多一些,但是也有一些场景需要用到代码动态添加布局,一些不确定的场景就需要了。主要代码如下
实现效果如下图所示:
ConstraintLayout.LayoutParams params = new ConstraintLayout.LayoutParams(width,height);
holder.catView.setLayoutParams(paramsView);
但是有个问题,这样修改完父布局后,子布局与...
0、ContraintLayout(约束布局)
(约束布局)ConstraintLayout 类似于 (相对布局)RelativeLayout,但约束布局比相对布局更灵活,性能更出色。而且ContraintLayout可以按照比例约束控件位置和尺寸,能够更好地适配屏幕不同的机型。
1、添加依赖
需要在app/build.gradle文件中添加ContraintLayout的依赖
implementation ‘com.android.support.constraint:constraint-la
android.support.
constraint.
ConstraintLayout记录一下:1.
android.support.
constraint.
ConstraintLayout 1.1.x 以上才有百分比属性,否则报错 app:
layout_
constraintWidth_percent="0.5"app:
layout_
constraintHeight_percent="0.5"
本文根据本人学习和使用记录的内容。
ConstraintLayout,比较牛逼的一种布局,结合了其他几种布局的优点,也可以看做RelativeLayout的升级版。
使用ConstraintLayout需要引入:
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
首先很重要也是很基础的几个属性
app:...