シークバーの背景の色を変える
2011年2月17日
シークバーの背景色を変えたい時には
まず、res/drawble-nodpiに適当な名前(今回はseekbar.xml)でファイルを作成
中身はlayer-listで、itemは以下を定義
- android:id="@android:id/background"
- android:id="@android:id/secondaryProgress"
- android:id="@android:id/progress"
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@android:id/background">
<shape>
<corners
android:radius="5dip" />
<gradient
android:startColor="#ff9d9e9d"
android:centerColor="#ff5a5d5a"
android:centerY="0.75"
android:endColor="#ff747674"
android:angle="270" />
</shape>
</item>
<item
android:id="@android:id/secondaryProgress">
<clip>
<shape>
<corners
android:radius="5dip" />
<gradient
android:startColor="#80ffd300"
android:centerColor="#80ffb600"
android:centerY="0.75"
android:endColor="#a0ffcb00"
android:angle="270" />
</shape>
</clip>
</item>
<item
android:id="@android:id/progress">
<clip>
<shape>
<corners
android:radius="5dip" />
<gradient
android:startColor="@color/progress_start"
android:endColor="@color/progress_end"
android:angle="270" />
</shape>
</clip>
</item>
</layer-list>
SeekBarオブジェクトでは、以下を指定
android:progressDrawable="@drawable/seekbar"
関連記事

LINX 3Dの通信環境
LINX 3DからはSIMを抜いているという話ついでに、どのように通信を行ってい ...

背景をグラデーションにする
<?xml version="1.0" encoding="utf-8"? ...

画像を画面サイズに切って表示させる
カメラ機能で撮影した画像などを画面にフルスクリーンで表示した場合、縦に伸びてしま ...

drawableのsetLevelとはなんぞや?
setLevel() で drawable に level を設定すると、lev ...

Wifi Toggle Widget
LINX 3Dは、SIMを抜いて、Wifiでのみ通信している状態ですが Wifi ...
