UI调整
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
|
||||
<corners android:bottomLeftRadius="16dp"
|
||||
android:bottomRightRadius="16dp"
|
||||
android:topLeftRadius="4dp"
|
||||
android:topRightRadius="16dp"/>
|
||||
|
||||
<solid android:color="@color/white"/>
|
||||
|
||||
</shape>
|
13
nim_uikit/res/drawable/bg_nim_water_drop_self_no_padding.xml
Normal file
13
nim_uikit/res/drawable/bg_nim_water_drop_self_no_padding.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<padding
|
||||
android:left="15dp"
|
||||
android:top="13dp"
|
||||
android:right="15dp"
|
||||
android:bottom="13dp" />
|
||||
|
||||
<solid android:color="#FFFCEBCA"/>
|
||||
|
||||
</shape>
|
@@ -49,12 +49,11 @@ public class BubbleView extends AppCompatTextView {
|
||||
setTextColor(ContextCompat.getColor(getContext(), R.color.white));
|
||||
setTextSize(10);
|
||||
GradientDrawable gradientDrawable = new GradientDrawable();
|
||||
gradientDrawable.setShape(GradientDrawable.RECTANGLE);
|
||||
gradientDrawable.setShape(GradientDrawable.OVAL);
|
||||
// gradientDrawable.setShape(GradientDrawable.RECTANGLE);
|
||||
gradientDrawable.setCornerRadius(ScreenUtil.dip2px(20));
|
||||
gradientDrawable.setColor(Color.parseColor("#FF3B30"));
|
||||
setBackground(gradientDrawable);
|
||||
setPadding(ScreenUtil.dip2px(4), ScreenUtil.dip2px(1), ScreenUtil.dip2px(4), ScreenUtil.dip2px(1));
|
||||
setGravity(Gravity.CENTER);
|
||||
// TextViewCompat.setAutoSizeTextTypeWithDefaults(this,TextViewCompat.AUTO_SIZE_TEXT_TYPE_UNIFORM);
|
||||
// TextViewCompat.setAutoSizeTextTypeUniformWithConfiguration(this,
|
||||
@@ -74,38 +73,22 @@ public class BubbleView extends AppCompatTextView {
|
||||
* @param num
|
||||
*/
|
||||
public void setNumText(int num) {
|
||||
// num += 100;
|
||||
if (num < 1) {
|
||||
setVisibility(GONE);
|
||||
return;
|
||||
}
|
||||
|
||||
setVisibility(VISIBLE);
|
||||
String numStr;
|
||||
if (num > 99) {
|
||||
numStr = "99+";
|
||||
numStr = "99";
|
||||
} else {
|
||||
numStr = String.valueOf(num);
|
||||
}
|
||||
getPaint().getTextBounds(numStr, 0, numStr.length(), textRect);
|
||||
int width = textRect.width() + getPaddingStart() + getPaddingEnd();
|
||||
int height = textRect.height() + getPaddingTop() + getPaddingBottom();
|
||||
ViewGroup.LayoutParams lp = getLayoutParams();
|
||||
lp.width = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
// if (num < 10) {
|
||||
// int size = Math.max(width, height);
|
||||
//// lp.width = size;
|
||||
//// lp.height = size;
|
||||
// lp.width = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
// lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
// } else {
|
||||
// lp.width = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
// lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||
// }
|
||||
|
||||
lp.width = ScreenUtil.dip2px(18);
|
||||
lp.height = ScreenUtil.dip2px(18);
|
||||
setLayoutParams(lp);
|
||||
setText(numStr);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user