GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - whisperI/RulerView: Android 刻度尺控件 RulerView

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

31 Commits
31 Commits

Folders and files

NameName
Last commit message
Last commit date
.idea
.idea
 
 
gradle/wrapper
gradle/wrapper
 
 
img
img
 
 
rulerlib
rulerlib
 
 
sample
sample
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

RulerView

Android自定义刻度尺控件

引用

在根目录下的build.gradle中添加

 allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
        }
    }

在项目目录下的build.gradle中添加

   dependencies {
    ...
    compile 'com.github.1169458576:RulerView:v1.0.3'
    
    }

示例

xml

    <com.zhzh.rulerlib.RulerView
            android:id="@+id/rulerView"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:layout_marginRight="16dp"
            android:layout_marginLeft="16dp"
            app:perWidth="10dp"
            app:minValue="0"
            app:maxValue="100"
            app:spacingValue="1"
            app:longSpacingValue="10"
            app:shortHeight="10dp"
            app:longHeight="15dp"
            app:middleHeight="20dp"
            app:lineWidth="1dp"
            app:middleLineWidth="1dp"
            app:middleLineColor="@android:color/holo_red_light"
            app:lineColor="@android:color/darker_gray"
            app:textSize="12sp"
            app:textMargin="10dp"
            app:showBaseLine="false"
            />

java

    rulerView=(RulerView) findViewById(R.id.rulerView);
    rulerView.setOnValueChangedListener(new RulerView.OnValueChangedListener() {
        @Override
        public void onValueChanged(int value) {
               txt.setText(String.valueOf(value));
            }
        });
    rulerView.scrollToValue(90);

说明

参数 说明 默认值
perWidth 每个刻度间隔距离 5dp
minValue 最小值 0
maxValue 最大值 100
spacingValue 每个刻度代表的值 1
shortHeight 短刻度高度 5dp
longHeight 长刻度高度 10dp
middleHeight 中线高度 15dp
lineWidth 刻度线宽 1dp
textSize 文字大小 12dp
lineColor 刻度线颜色 GRAY
middleLineColor 中线颜色 RED
textColor 文字颜色 GRAY
middleLineWidth 中线宽度 1dp
textMargin 文字与长刻度间距 10dp
longSpacingValue 长刻度间隔刻度值 10
showBaseLine 是否显示底线 否
方法 说明
scrollToValue(int value) 滚动到 value(在minValue~maxValue范围内且能被spacingValue整除)

About

Android 刻度尺控件 RulerView

Resources

Readme
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.