Skip to content

Commit

Permalink
Change attr name
Browse files Browse the repository at this point in the history
  • Loading branch information
7heaven committed Aug 19, 2016
1 parent e2da7ba commit 3b80954
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
Binary file added .README.md.swp
Binary file not shown.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ set segmentControl's property using attrs,using '|' to separate segments.
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:textSize="18sp"
app:colors="#0099CC"
app:selectedColor="#32ADFF"
app:normalColor="#FFFFFF"
app:cornerRadius="5dp"
app:direction="vertical"
android:orientation="horizontal"
app:horizonGap="10dp"
app:separatorWidth="2dp"
app:boundWidth="4dp"
app:textSelectedColors="#E74C3C"
app:texts="啊啊|啦啦啦|哈哈哈|顶顶顶顶"
app:verticalGap="10dp"/>
```
Expand Down
4 changes: 2 additions & 2 deletions example/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
app:selectedColor="#0099CC"
app:normalColor="#FFFFFF"
app:cornerRadius="5dip"
app:block_direction="horizon"
android:orientation="horizontal"
app:horizonGap="8dip"
app:texts="啊啊|啦啦啦|哈哈哈|顶顶顶顶"
app:verticalGap="8dip"/>
Expand All @@ -34,7 +34,7 @@
app:textColors="@color/text_color"
app:backgroundColors="@color/background_color"
app:cornerRadius="5dp"
app:block_direction="vertical"
android:orientation="vertical"
app:texts="aa|bb|cc"
app:horizonGap="10dp"
app:separatorWidth="1dp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public SegmentControl(Context context, AttributeSet attrs, int defStyle) {

mTextSize = ta.getDimensionPixelSize(R.styleable.SegmentControl_android_textSize, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 14, context.getResources().getDisplayMetrics()));
mCornerRadius = ta.getDimensionPixelSize(R.styleable.SegmentControl_cornerRadius, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, context.getResources().getDisplayMetrics()));
mDirection = Direction.values()[ta.getInt(R.styleable.SegmentControl_block_direction, 0)];
mDirection = Direction.values()[ta.getInt(R.styleable.SegmentControl_android_orientation, 0)];

mHorizonGap = ta.getDimensionPixelSize(R.styleable.SegmentControl_horizonGap, 0);
mVerticalGap = ta.getDimensionPixelSize(R.styleable.SegmentControl_verticalGap, 0);
Expand Down
5 changes: 1 addition & 4 deletions segmentcontrol/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
<attr name="textColors" format="color|reference"/>
<attr name="texts" format="string|reference"/>
<attr name="android:textSize"/>
<attr name="block_direction" format="enum">
<enum name="horizon" value="0"/>
<enum name="vertical" value="1"/>
</attr>
<attr name="android:orientation" />
<!-- 外部边框的width -->
<attr name="boundWidth" format="dimension|reference"/>
<!-- 内部边框的width -->
Expand Down

0 comments on commit 3b80954

Please sign in to comment.