Browse Source

MyTitleView 修改

niusongtao@dl-cg.com 5 years ago
parent
commit
d216c5cc74

+ 4 - 0
base_library/src/main/java/com/mgtech/base_library/custom/MyTitleView.java

@@ -5,6 +5,7 @@ import android.content.res.TypedArray;
 import android.graphics.Color;
 import android.graphics.drawable.Drawable;
 import android.util.AttributeSet;
+import android.util.TypedValue;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.ImageView;
@@ -72,6 +73,9 @@ public class MyTitleView extends ConstraintLayout implements View.OnClickListene
         bgLayout.setBackgroundColor(typedArray.getColor(R.styleable.MyTitleView_title_bg_color, Color.WHITE));
         titleText.setText(typedArray.getText(R.styleable.MyTitleView_title_text));
         rightText.setText(typedArray.getText(R.styleable.MyTitleView_title_right_text));
+        rightText.setTextColor(typedArray.getColor(R.styleable.MyTitleView_title_right_text_color,Color.BLACK));
+        rightText.setTextSize(TypedValue.COMPLEX_UNIT_SP,typedArray.getDimension(R.styleable.MyTitleView_title_right_text_size
+                ,rightText.getTextSize()));
         leftImage.setImageResource(typedArray.getResourceId(R.styleable.MyTitleView_left_image, 0));
         rightImage.setImageResource(typedArray.getResourceId(R.styleable.MyTitleView_right_image, 0));
         titleText.setTextColor(typedArray.getColor(R.styleable.MyTitleView_title_text_color, Color.BLACK));