2017-12-15 8 views
0

複数の図形を1つのドロアブルに入れることはできますか?複数の図形をドロウアブルで表示する

seekbarに "progressDrawable"を作成しようとしています。単一の描画可能なリソースファイルで、個々の円を作成し、パディング(おそらく私が推測する)でオフセットすることによって、

Android Studioの「プレビュー」に表示されているように動作しないようです。 私はAndroid開発を始めました。私はこれを男の子たちに理解させてください。また、これらの個々のサークルを描画可能なファイルにする代わりに、これを行うためのより良い方法があるかもしれないと感じています。私はこのようなものを作成しようとしている

enter image description here

私がこれまでに成し遂げてきた何:

<SeekBar 
    android:id="@+id/slider" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerHorizontal="true" 
    android:layout_centerVertical="true" 
    android:layout_toRightOf="@+id/seekbar_cancel" 
    android:layout_toLeftOf="@+id/seekbar_apply" 
    android:progressDrawable="@drawable/custom_seeker" 
    /> 

custom_seeker.xml:

<?xml version="1.0" encoding="utf-8"?> 

<item android:top="0dp" android:left="0dp" android:bottom="7dp" android:right="7dp"> 
    <shape android:shape="oval"> 
     <size android:width="1dp" 
      android:height="1dp"/> 
     <solid android:color="#f06"/> 
    </shape> 
</item> 
<item android:top="0dp" android:left="2dp" android:bottom="7dp" android:right="5dp"> 
    <shape android:shape="oval"> 
     <size android:width="1dp" 
      android:height="1dp"/> 
     <solid android:color="#0f0"/> 
    </shape> 
</item> 

<item android:top="0dp" android:left="4dp" android:bottom="7dp" android:right="3dp"> 
    <shape android:shape="oval"> 
     <size android:width="1dp" 
      android:height="1dp"/> 
     <solid android:color="#0f8"/> 
    </shape> 
</item> 
<item android:top="0dp" android:left="6dp" android:bottom="7dp" android:right="1dp"> 
    <shape android:shape="oval"> 
     <size android:width="1dp" 
      android:height="1dp"/> 
     <solid android:color="#f00"/> 
    </shape> 
</item> 

答えて

0

それは、単一の描画可能で、複数の形状にすることは可能ですか?

はい、あなたが使用する必要がありますlayer-list

関連する問題