-
Notifications
You must be signed in to change notification settings - Fork 168
3_modify ui(自定义部分样式)
水牛 edited this page Jan 24, 2018
·
5 revisions
- set widthPercent or heightPercent of the dialog window:
//default is wrapcontent ,is full fill the screen ,it will automatically change to 0.8-0.9f.
setForceWidthPercent(@FloatRange(from = 0f,to = 1.0f)float forceWidthPercent)
setMaxWidthPercent(@FloatRange(from = 0f,to = 1.0f) float maxWidthPercent)
setForceHeightPercent(@FloatRange(from = 0f,to = 1.0f) float forceheightPercent)
setMaxHeightPercent(@FloatRange(from = 0f,to = 1.0f) float maxHeightPercent)
- disable the white and shadow background: mostly used in custom view dialog
//default is true
setHasShadow(boolean useTheShadowBg)
or:
.setBgRes(R.drawable.leak_canary_icon)
- disable the dimlayer(half transparent layer) behind
setTransparentBehind(boolean transparentBehind)
setthe button text,change text size and color. the layout contains 3 buttons,if you set a button text as "",it will hide. at least 1 button will show
setBtnText(CharSequence positiveTxt)
setBtnText(CharSequence positiveTxt, @Nullable CharSequence negtiveText)
setBtnText(CharSequence btn1Text, @Nullable CharSequence btn2Text, @Nullable CharSequence btn3Text)
setBtnSize(int sizeInSp)
setBtnColor(@ColorRes int btn1Color, @ColorRes int btn2Color, @ColorRes int btn3Color)
the text content has forced to set in top api,the color or size can be changed or use the default
setTitleColor(@ColorRes int colorRes)
setMsgColor(@ColorRes int colorRes)
setTitleSize(int sizeInSp)
setMsgSize(int sizeInSp)
setListItemColor(@ColorRes int lvItemTxtColor, Map<Integer, Integer> colorOfPosition)
setLvItemSize(int sizeInSp)
- show 1 or 2 edittext: if hint2 and secondTxt is empty ,then the second edittext will hide.
buildNormalInput( CharSequence title, CharSequence hint1, CharSequence hint2, CharSequence firstTxt, CharSequence secondTxt, MyDialogListener listener)
- edittext style:
setInputSize(int sizeInSp)//text size
seInputColor(@ColorRes int colorRes)
setInput2HideAsPassword(boolean input2HideAsPassword)//
- callback for validate input in MyDialogListener:
public boolean onInputValid(CharSequence input1, CharSequence input2, EditText editText1,EditText editText2){
return true;
}
- modify style:
.setBottomSheetStyle(BottomSheetStyle.newBuilder()
.bottomTxtColor(R.color.common_color_333333)
.txtColor(R.color.common_color_999999)
...
.txtMarginTopDp(0).build())
- modify behaviour:
.setHasBehaviour(false)