|
|
@@ -12,6 +12,7 @@ import android.widget.TextView;
|
|
|
|
|
|
import androidx.annotation.ColorInt;
|
|
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
|
|
+import androidx.constraintlayout.widget.ConstraintSet;
|
|
|
|
|
|
import com.mgtech.base_library.R;
|
|
|
|
|
|
@@ -95,6 +96,26 @@ public class CommonUserItemView extends ConstraintLayout {
|
|
|
} else if (type == 30){//italic
|
|
|
detailText.setTypeface(Typeface.defaultFromStyle(Typeface.ITALIC));
|
|
|
}
|
|
|
+
|
|
|
+ int gravityType = typedArray.getInt(R.styleable.CommonUserItemView_item_wrap_style,10);
|
|
|
+ ConstraintSet set= new ConstraintSet();
|
|
|
+ if (gravityType == 10){//left
|
|
|
+ set.clone(this);
|
|
|
+ set.constrainWidth(titleText.getId(),0);
|
|
|
+ set.constrainWidth(detailText.getId(),ConstraintSet.WRAP_CONTENT);
|
|
|
+ set.applyTo(this);
|
|
|
+ } else if (gravityType == 20){//center
|
|
|
+ set.clone(this);
|
|
|
+ set.constrainWidth(titleText.getId(),0);
|
|
|
+ set.constrainWidth(detailText.getId(),0);
|
|
|
+ set.applyTo(this);
|
|
|
+ } else if (gravityType == 30){//right
|
|
|
+ set.clone(this);
|
|
|
+ set.constrainWidth(titleText.getId(),ConstraintSet.WRAP_CONTENT);
|
|
|
+ set.constrainWidth(detailText.getId(),0);
|
|
|
+ set.applyTo(this);
|
|
|
+ }
|
|
|
+
|
|
|
lineView.setVisibility(typedArray.getBoolean(R.styleable.CommonUserItemView_item_line_show,true)
|
|
|
?VISIBLE:GONE);
|
|
|
typedArray.recycle();
|