0

https://github.com/ChristopheVersieux/HoloEverywhereの例に従って、 下の図に示す Seekbar を作成しました。ただ、私の初級レベルに比べると上達しすぎて、

誰かがこれを行う方法を教えていただければ幸いです。関連するコードのみが必要ですか?

ここに画像の説明を入力

4

2 に答える 2

2

私はそれを手に入れました、私は以下の android:thumb がありませんでした:

<SeekBar
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/seekBar1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_below="@+id/topBar"
            android:layout_marginTop="26dip"
            android:paddingLeft="10dip"
            android:paddingRight="10dip"
            android:paddingTop="10dip"
            android:max="10000"
            style="?android:attr/progressBarStyleHorizontal" 
             android:progressDrawable="@drawable/scrubber_progress_horizontal_holo_light"

              android:thumb="@drawable/scrubber_control_selector_holo" >
        </SeekBar>

ドローアブルで:

<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/scrubber_control_disabled_holo" android:state_enabled="false"/>
    <item android:drawable="@drawable/scrubber_control_pressed_holo" android:state_pressed="true"/>
    <item android:drawable="@drawable/scrubber_control_focused_holo" android:state_selected="true"/>
     <item android:drawable="@drawable/scrubber_control_normal_holo"/>

</selector>

と:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
        android:id="@android:id/background"
        android:drawable="@drawable/scrubber_track_holo_light"/>
    <item android:id="@android:id/secondaryProgress">
        <scale
            android:drawable="@drawable/scrubber_secondary_holo"
            android:scaleWidth="100%" />
      </item>
    <item android:id="@android:id/progress">
        <scale
            android:drawable="@drawable/scrubber_primary_holo"
            android:scaleWidth="100%" />
    </item>

</layer-list>

もちろん、そこからの画像も必要です。

于 2012-08-29T21:21:58.523 に答える
1

テーマを使用するには、res/values フォルダに次のコードを含む「themes.xml」ファイルが必要です (ライブラリがインポートされていると仮定します...)。

<style name="YourTheme" parent="Theme.HoloEverywhereLight">
    <!-- You can customize the theme here! -->
</style>          

アプリケーションの AndroidManifest ファイルで、テーマを適用します。

<application
    android:icon="@drawable/app_launch_icon"
    android:label="@string/app_name"
    android:theme="@style/YourTheme" >

そして最後に、アクティビティの main.xml レイアウトで、次のようにシークバーをどこかに追加します。

<SeekBar
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:progress="75" />
于 2012-08-29T21:19:26.807 に答える