LoginSignup
31
29

More than 3 years have passed since last update.

【Android】進捗率を表現するための円形ゲージなViewを公開しました

Last updated at Posted at 2016-08-10

2018/2/28、スタディプラス株式会社を退社しました。
2019/11/5、リポジトリが消えていたので、近々書き直します。


こんにちは、りんごのマークをこよなく愛すmayahiroです。
りんごのマークをこよなく愛していますが、なぜかポジションはAndroidアプリエンジニアです。

さて、この度、StudyplusAndroidアプリで使っている円形ゲージViewを公開することにいたしました。

https://github.com/studyplus/GaugeSampleApplication

特徴

1.円形のゲージをお手軽に表示できます。(GaugeView.java

単色表示 グラデーション表示 リミットブレイク表示
単色.png グラデーション.png リミットブレイク.png

※リミットブレイク: 個人的に100%を超えた状態をそう呼んでいます

2.リスト表示で使う用にシンプルなデザインも用意しました。(SimpleGaugeView.java

単色表示 グラデーション表示 リミットブレイク表示
単色シンプル.png グラデーションシンプル.png リミットブレイクシンプル.png

3.もちろんアニメーションします。

単色アニメーション 複数色アニメーション リミットブレイクアニメーション
単色アニメーション.gif グラデーションアニメーション.gif リミットブレイクアニメーション.gif

※ シンプルデザインな方はしません。
※ タップで何度もアニメーションを堪能できます。

使い方

  1. 適当にlayoutに配置

    <com.mayahiro.gaugesampleapplication.GaugeView
                    android:id="@+id/gauge1"
                    android:layout_width="match_parent"
                    android:layout_height="300dp"
                    android:layout_margin="16dp" />
    
    <com.mayahiro.gaugesampleapplication.SimpleGaugeView
                    android:id="@+id/simple_gauge1"
                    android:layout_width="match_parent"
                    android:layout_height="300dp"
                    android:layout_margin="16dp" />
    
  2. 適当にデータをセット

    GaugeView gauge1View = (GaugeView) findViewById(R.id.gauge1);
    gauge1View.setData(90, "%", ContextCompat.getColor(this, R.color.color_90), 90, true);
    
    SimpleGaugeView simpleGauge1View = (SimpleGaugeView) findViewById(R.id.simple_gauge1);
    simpleGauge1View.setData(90, "%", ContextCompat.getColor(this, R.color.color_90));
    
  3. 詳細についてはサンプルプロジェクトをご覧ください。

https://github.com/studyplus/GaugeSampleApplication

最後に

ファイル1つでお手軽に使えるようになっているので、進捗率を表示したくなった際には、ぜひお使いください。
ご意見、ご感想、Issue、Pull request等々、お待ちしております。

31
29
6

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
31
29