Android 自定义View 仪表盘

Related tags

UI/UX DashboardView
Overview

DashboardView

Android 自定义View 仪表盘

DashboardView

##HOW TO USE

###gradle

root build.gradle:

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

moudle build.gradle:

compile 'com.github.SuperKung:DashboardView:1.2.1'

###xml

<com.anderson.dashboardview.view.DashboardView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/panView"
        android:text="当前速度"
        app:Unit="m/s"/>
more
  app:startNumber
  app:maxNumber
  app:backgroundColor
  app:progressColor
  app:startProgressColor
  app:endProgressColor
  app:progressStrokeWidth
  app:tikeStrArray
  app:tikeStrColor
  app:tikeStrSize
  app:startNumber
  app:maxNumber
  app:centerCircleColor

###java

setPercent(int percent);//核心方法,percent = 0~100
//以下方法都可有可无,如果在xml中设置了则不必重复设置,适用于需要动态改变状态的情况
setText(String text);
setTextSize(int size);
setTextColor(int mTextColor);
setProgressHeight(int dp);
setUnit(String unit);
setInterpolator(TimeInterpolator interpolator);//设置动画插值器,从而达到不同的动画效果
setStartColor(int startColor);
setEndColor(int endColor);//如果设置了起始颜色和结束颜色,进度条会变成渐变色
setStartNum(float startNum);
setMaxNum(float startNum);

该控件相关博客

You might also like...
Make your native android Dialog Fancy. A library that takes the standard Android Dialog to the next level with a variety of styling options. Style your dialog from code.
Make your native android Dialog Fancy. A library that takes the standard Android Dialog to the next level with a variety of styling options. Style your dialog from code.

FancyAlertDialog-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ..

Xamarin.Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
Xamarin.Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#

Xamarin.Android Xamarin.Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#. Build Status Platform

A Tinder-like Android library to create the swipe cards effect. You can swipe left or right to like or dislike the content.

Swipecards Travis master: A Tinder-like cards effect as of August 2014. You can swipe left or right to like or dislike the content. The library create

Bootstrap style widgets for Android, with Glyph Icons
Bootstrap style widgets for Android, with Glyph Icons

Android-Bootstrap Android Bootstrap is an Android library which provides custom views styled according to the Twitter Bootstrap Specification. This al

[] A fast PDF reader component for Android development
[] A fast PDF reader component for Android development

This project is no longer maintained. You can find a good replacement here, which is a fork relying on Pdfium instead of Vudroid/MuPDF for decoding PD

[] Define and render UI specs on top of your Android UI
[] Define and render UI specs on top of your Android UI

dspec A simple way to define and render UI specs on top of your Android UI. Usage Enclose the target UI with a DesignSpecFrameLayout, usually the root

A Material design Android pincode library. Supports Fingerprint.
A Material design Android pincode library. Supports Fingerprint.

LolliPin A Lollipop material design styled android pincode library (API 14+) To include in your project, add this to your build.gradle file: //Loll

Android Library to implement simple touch/tap/swipe gestures
Android Library to implement simple touch/tap/swipe gestures

SimpleFingerGestures An android library to implement simple 1 or 2 finger gestures easily Example Library The library is inside the libSFG folder Samp

Android layout decorators : Injecting custom attributes in layout files, Using decorators to get rid of unnecessary class explosion with custom views
Android layout decorators : Injecting custom attributes in layout files, Using decorators to get rid of unnecessary class explosion with custom views

Decor Decor is a library that applies decorators to Android layout with additional attributes without the need to extend and create a custom View for

Comments
  • 直接setPercent(100)会出现数据有误的BUG

    直接setPercent(100)会出现数据有误的BUG

    在xml中设置app:maxNumber="100" 当我直接设值setPercent(100)的时候,一边数字就会出现显示“101.0” 但当我 if (i < 100) { i = i + 20; } else if (i == 100) { i = 1; } dashboardView.setPercent(i);时却不会出现此问题 应该是在计算的时候的问题,望能修复次BUG

    opened by zzsakurazz 3
  • android 4.4 崩溃

    android 4.4 崩溃

    06-30 11:30:46.524 30601-30601/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.anderson.example, PID: 30601 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.anderson.example/com.anderson.example.MainActivity}: android.view.InflateException: Binary XML file line #9: Error inflating class com.anderson.dashboardview.view.DashboardView at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2271) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2320) at android.app.ActivityThread.access$800(ActivityThread.java:138) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1269) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5117) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at dalvik.system.NativeStart.main(Native Method) Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class com.anderson.dashboardview.view.DashboardView at android.view.LayoutInflater.createView(LayoutInflater.java:620) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696) at android.view.LayoutInflater.rInflate(LayoutInflater.java:755) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:397) at android.view.LayoutInflater.inflate(LayoutInflater.java:353) at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) at com.anderson.example.MainActivity.onCreate(MainActivity.java:15) at android.app.Activity.performCreate(Activity.java:5340) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1099) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2235) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2320)  at android.app.ActivityThread.access$800(ActivityThread.java:138)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1269)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5117)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)  at dalvik.system.NativeStart.main(Native Method)  Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.constructNative(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at android.view.LayoutInflater.createView(LayoutInflater.java:594) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)  at android.view.LayoutInflater.inflate(LayoutInflater.java:492)  at android.view.LayoutInflater.inflate(LayoutInflater.java:397)  at android.view.LayoutInflater.inflate(LayoutInflater.java:353)  at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)  at com.anderson.example.MainActivity.onCreate(MainActivity.java:15)  at android.app.Activity.performCreate(Activity.java:5340)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1099)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2235)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2320)  at android.app.ActivityThread.access$800(ActivityThread.java:138)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1269)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5117)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)  at dalvik.system.NativeStart.main(Native Method)  Caused by: java.lang.NoClassDefFoundError: com.anderson.dashboardview.Interpolator.SpringInterpolator at com.anderson.dashboardview.view.DashboardView.(DashboardView.java:69) at com.anderson.dashboardview.view.DashboardView.(DashboardView.java:77) at java.lang.reflect.Constructor.constructNative(Native Method)  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)  at android.view.LayoutInflater.createView(LayoutInflater.java:594)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)  at android.view.LayoutInflater.inflate(LayoutInflater.java:492)  at android.view.LayoutInflater.inflate(LayoutInflater.java:397)  at android.view.LayoutInflater.inflate(LayoutInflater.java:353)  at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)  at com.anderson.example.MainActivity.onCreate(MainActivity.java:15)  at android.app.Activity.performCreate(Activity.java:5340)  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1099)  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2235)  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2320)  at android.app.ActivityThread.access$800(ActivityThread.java:138)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1269)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5117)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:515)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)  at dalvik.system.NativeStart.main(Native Method)  已处理

    opened by kongnanlive 1
Releases(1.2.1)
Owner
SuperKung
SuperKung
TourGuide is an Android library that aims to provide an easy way to add pointers with animations over a desired Android View

TourGuide TourGuide is an Android library. It lets you add pointer, overlay and tooltip easily, guiding users on how to use your app. Refer to the exa

Tan Jun Rong 2.6k Jan 5, 2023
Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.

Bubbles for Android Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your

Txus Ballesteros 1.5k Jan 2, 2023
View that imitates Ripple Effect on click which was introduced in Android L (for Android 2.3+)

RippleView View that imitates Ripple Effect on click which was introduced in Android L. Usage For a working implementation, Have a look at the Sample

Muthuramakrishnan Viswanathan 1.2k Dec 30, 2022
A new canvas drawing library for Android. Aims to be the Fabric.js for Android. Supports text, images, and hand/stylus drawing input. The library has a website and API docs, check it out

FabricView - A new canvas drawing library for Android. The library was born as part of a project in SD Hacks (www.sdhacks.io) on October 3rd. It is cu

Antwan Gaggi 1k Dec 13, 2022
MarkdownView is an Android webview with the capablity of loading Markdown text or file and display it as HTML, it uses MarkdownJ and extends Android webview.

About MarkdownView (Markdown For Android) is an Android library that helps you display Markdown text or files (local/remote) as formatted HTML, and st

Feras Alnatsheh 1k Dec 20, 2022
SwipeBack for Android Activities to do pretty the same as the android "back-button" will do, but in a really intuitive way by using a swipe gesture

SwipeBack SwipeBack is for Android Activities to do pretty the same as the android "back-button" will do, but in a really intuitive way by using a swi

Hannes Dorfmann 697 Dec 14, 2022
A backport of the SwitchPreference component that was introduced on Android 4 (ICS / level 14). This port works on Android 2.1+ (Eclair MR1 / level 7).

Android Switch Preference Backport A backport of the SwitchPreference component that was introduced on Android 4 (ICS / level 14). This port works on

Benoit Lubek 498 Dec 29, 2022
Wizard Pager is a library that provides an example implementation of a Wizard UI on Android, it's based of Roman Nurik's wizard pager (https://github.com/romannurik/android-wizardpager)

Wizard Pager Wizard Pager is a library that provides an example implementation of a Wizard UI on Android, it's based of Roman Nurik's wizard pager (ht

Julián Suárez 520 Nov 11, 2022
Make your native android Toasts Fancy. A library that takes the standard Android toast to the next level with a variety of styling options. Style your toast from code.

FancyToast-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ... ma

Shashank Singhal 1.2k Dec 26, 2022