Skip to content

Commit

Permalink
加入更多效果
Browse files Browse the repository at this point in the history
  • Loading branch information
yizems committed Dec 22, 2016
1 parent 4a60301 commit 7d41fa4
Show file tree
Hide file tree
Showing 11 changed files with 420 additions and 43 deletions.
55 changes: 51 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@
## 1 效果图
![image](https://github.com/yizeliang/RulerView/raw/master/img/1.png)

![image](https://github.com/yizeliang/RulerView/raw/master/img/2.png)

![image](https://github.com/yizeliang/RulerView/raw/master/img/3.png)

![image](https://github.com/yizeliang/RulerView/raw/master/img/4.png)

![image](https://github.com/yizeliang/RulerView/raw/master/img/5.png)

![image](https://github.com/yizeliang/RulerView/raw/master/img/6.png)

## 2 使用方法

```xml
<cn.yzl.ruleview.library.widget.RulerView
app:bottom_line_color="#123439"
<cn.yzl.ruleview.library.widget.RulerView
app:base_line_color="#123439"
app:line_space="10dp"
app:line_width="2dp"
app:max_line_color="#303F9F"
Expand All @@ -19,6 +29,18 @@
app:text_size="15sp"
app:text_color="@color/colorAccent"

app:base_line_height="1px"

app:base_line_gravity="top"

app:text_gravity="bottom"

app:line_gravity="top"

app:show_base_line="true"

app:max_line_count="4"
app:mid_line_count="2"
android:id="@+id/ruler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down Expand Up @@ -69,7 +91,14 @@
| app:indicator_size | 指示器宽度 |
| app:text_size | 文字大小 |
| app:text_color | 文字颜色 |

| app:text_gravity | 文字位置 |
| app:base_line_color | 基线颜色 |
| app:base_line_gravity | 基线位置 |
| app:base_line_height | 基线高度 |
| app:show_base_line | 是否显示基线 |
| app:line_gravity | 刻度位置 |
| app:max_line_count | 多少个刻度显示一个最长刻度线 默认10 |
| app:mid_line_count | 多少刻度显示一个中等刻度线 默认5 |

## 4 依赖库

Expand All @@ -83,8 +112,26 @@ allprojects {
}
//module
dependencies {
compile 'com.github.yizeliang:RulerView:1.2'
compile 'com.github.yizeliang:RulerView:1.3'
}
```

## 5更新日志

### 1.3版本

- 加入 基线 文字,刻度 的位置变化属性

### 1.2版本

- 修复 选定位置后没有取消惯性的bug

### 1.1版本

- 修复项目滑动相关的bug

### 1.0版本

- 创建项目 实现基本功能

8 changes: 4 additions & 4 deletions app/src/main/java/cn/yzl/ruleview/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@

public class MainActivity extends AppCompatActivity {


private RulerView rulerView;
private RulerView rulerView,rulerView2;

private Button but;
private TextView tv;
Expand All @@ -26,7 +25,7 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
rulerView = (RulerView) findViewById(R.id.ruler);

rulerView2= (RulerView) findViewById(R.id.ruler2);
tv = (TextView) findViewById(R.id.tv);
but = (Button) findViewById(R.id.but);
but.setOnClickListener(new View.OnClickListener() {
Expand All @@ -45,7 +44,7 @@ public void scroll(int position, String content) {
@Override
public void finish(int position, String content) {
tv.setText(content);
Toast.makeText(MainActivity.this, "滑动结束", 1).show();
ToastUtils.showShort(MainActivity.this, "滑动结束");
}
});

Expand All @@ -55,5 +54,6 @@ public void finish(int position, String content) {
data.add(String.valueOf(i * 100));
}
rulerView.setData(data);
rulerView2.setData(data);
}
}
55 changes: 39 additions & 16 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<cn.yzl.ruleview.library.widget.RulerView
app:bottom_line_color="#123439"
app:line_space="10dp"
app:line_width="2dp"
app:max_line_color="#303F9F"
app:mid_line_color="#17E5A7"
app:min_line_color="#E3E3E3"
app:indicator_color="#DB6958"
app:indicator_size="2dp"
app:text_size="15sp"
app:text_color="@color/colorAccent"

android:id="@+id/ruler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp" />
app:base_line_color="#123439"
app:line_space="10dp"
app:line_width="2dp"
app:max_line_color="#303F9F"
app:mid_line_color="#17E5A7"
app:min_line_color="#E3E3E3"
app:indicator_color="#DB6958"
app:indicator_size="2dp"
app:text_size="15sp"
app:text_color="@color/colorAccent"

app:base_line_height="1px"

app:base_line_gravity="top"

app:text_gravity="top"

app:line_gravity="top"

app:show_base_line="true"

app:max_line_count="10"
app:mid_line_count="5"
android:id="@+id/ruler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp" />


<TextView
Expand All @@ -39,4 +51,15 @@
android:layout_height="wrap_content"
android:text="选择位置,第10个" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="默认效果" />

<cn.yzl.ruleview.library.widget.RulerView
android:id="@+id/ruler2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp" />

</LinearLayout>
Binary file modified img/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7d41fa4

Please sign in to comment.