Skip to content

Commit

Permalink
【Jiang】:加入Item的 Title的宽度设置
Browse files Browse the repository at this point in the history
  • Loading branch information
jxr202 committed Apr 23, 2018
1 parent aea48fa commit 465b6e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class ItemView extends RelativeLayout {
private int mLeftIconId;
private int mRightIconId;
private int mRightIconVisibility;
private int mLeftTitleWidth;

public ItemView(Context context, AttributeSet attrs) {
super(context, attrs);
Expand All @@ -54,6 +55,7 @@ private void initTypedArray(Context context, AttributeSet attrs, int defStyleAtt
mLeftIcon.setImageDrawable(array.getDrawable(R.styleable.ItemView_mLeftImage));
mLeftIcon.setVisibility(array.getInteger(R.styleable.ItemView_mLeftImageVisibility, VISIBLE));

mLeftTitleWidth = dp2px(array.getDimension(R.styleable.ItemView_mLeftTitleWidth, 200));
mLeftTitle.setId(array.getResourceId(R.styleable.ItemView_mLeftTitleId, R.id.leftTextId));
mLeftTitle.setText(array.getString(R.styleable.ItemView_mLeftTitleText));
mLeftTitle.setTextSize(px2dip(array.getDimension(R.styleable.ItemView_mLeftTitleTextSize, 15)));
Expand Down Expand Up @@ -84,7 +86,7 @@ private void initTypedArray(Context context, AttributeSet attrs, int defStyleAtt

private void initView() {
RelativeLayout.LayoutParams leftIconParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
RelativeLayout.LayoutParams leftTitleParams = new RelativeLayout.LayoutParams(dp2px(180), ViewGroup.LayoutParams.WRAP_CONTENT);
RelativeLayout.LayoutParams leftTitleParams = new RelativeLayout.LayoutParams(mLeftTitleWidth, ViewGroup.LayoutParams.WRAP_CONTENT);
RelativeLayout.LayoutParams rightIconParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
RelativeLayout.LayoutParams rightTextParams = new RelativeLayout.LayoutParams(dp2px(80), ViewGroup.LayoutParams.WRAP_CONTENT);
LayoutParams bottomLineParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 1);
Expand Down
1 change: 1 addition & 0 deletions colorful-ui/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@

<attr name="mLeftTitleId"/>
<attr name="mLeftTitleText"/>
<attr name="mLeftTitleWidth"/>
<attr name="mLeftTitleTextSize"/>
<attr name="mLeftTitleTextColor"/>
<attr name="mLeftTitleTextVisibility"/>
Expand Down

0 comments on commit 465b6e6

Please sign in to comment.