Seekbar - 添加图像同样分配点

时间:2017-06-10 10:01:49

标签: java android xml android-layout

我想实现类似的UI,如图所示。我有点均匀分布,但如何在平均分布下添加图像。 enter image description here

github.com/woxingxiao/BubbleSeekBar

result

<LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <com.xw.repo.BubbleSeekBar
                    android:id="@+id/bubbleSeekBar"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"

                    android:layout_marginTop="8dp"
                    app:bsb_auto_adjust_section_mark="true"
                    app:bsb_bubble_color="@color/colorVitalRed"
                    app:bsb_bubble_text_color="@color/colorWhite"
                    app:bsb_max="10"
                    app:bsb_min="0"
                    app:bsb_progress="0"
                    app:bsb_second_track_color="@color/blue"
                    app:bsb_section_count="10"
                    app:bsb_section_text_position="below_section_mark"
                    app:bsb_show_progress_in_float="false"
                    app:bsb_show_section_mark="true"
                    app:bsb_show_section_text="true"
                    app:bsb_show_thumb_text="false"
                    app:bsb_track_color="@color/colorWhite" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <ImageView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:src="@drawable/ic_pain_0_emoticon" />

                <ImageView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:src="@drawable/ic_pain_0_emoticon" />

                <ImageView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:src="@drawable/ic_pain_0_emoticon" />

                <ImageView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:src="@drawable/ic_pain_0_emoticon" />

                <ImageView
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:src="@drawable/ic_pain_0_emoticon" />
            </LinearLayout>
        </LinearLayout>

1 个答案:

答案 0 :(得分:1)

查看

Result

public class Matching {        
    public static int match = (int) Math.floor(Math.random()*cities.size()); //Error is here
}

注意: 请使用我的图片和颜色资源更改您的图片资源