2016-02-12 22 views
9

enter image description hereディスクリートスライダの目盛りを表示するには?

私は離散スライダーラベルのようなシークバー/スライダーのスタイルをしようとしている - Material Design Guidelinesに(つまり、小さな目盛りのインジケータがあります)をクリックします。私は目盛りを表示するには、魔法の呪文を理解することはできません誰もこれを行う方法を知っていますか?目盛りの描画可能に設定することにより、手動で

<SeekBar 
    android:id="@+id/seekBar" 
    style="@style/Widget.AppCompat.SeekBar.Discrete" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:max="10" 
    /> 

するか、それらを追加します:

私はスタイル属性と目盛りを追加

<SeekBar 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:max="4" /> 
+0

この質問は、ヒントとは関係がありません。これは目盛りと素材デザインに関するものです。 –

答えて

12

5位(0-4)でシークバーを持っている

<SeekBar 
    android:id="@+id/seekBar" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:max="10" 
    android:tickMark="@drawable/tickmark" 
    /> 

tickmark.xml

<shape xmlns:android="http://schemas.android.com/apk/res/android" 
     android:shape="oval"> 
    <size android:width="4dp" 
      android:height="4dp"/> 
    <solid android:color="@android:color/white"/> 
</shape> 
+4

ああ、この最近24.x.xサポートlibに追加されました(23.4.0で利用可能であることが表示されません)私はシークバー上のティッカー表示が届かない –

+0

@Namespaceのように見える、あなたは私を助けてくださいことはできますか? – Pankaj

関連する問題