How to make a search engine like a thermometer

I set up the search bar and its working tone, but the real problem is to draw a notched thermometer on it, which can be dynamic, and takes an equal distance compared to the search bar.

Example Seek Bar Max = 10 then there should be 10 segments for which we need to draw 11 lines at an equal distance so that the thumb exactly matches the notch.

enter image description here

+2
source share
1 answer

To keep things simple, you can use the search bar with RelativeLayout, which displays a thermometer image in the background.

, drawbles. android: rotation = "- 90"

         <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/root_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="horizontal">

            <RelativeLayout
                android:layout_width="632px"
                android:layout_height="1300px"
                android:layout_below="@+id/rel"
                android:layout_gravity="center"
                android:background="@drawable/thermometer1">

            </RelativeLayout>

            <SeekBar
                android:layout_width="1052px"
                android:layout_height="50dp"
                android:layout_marginLeft="136dp"
                android:layout_marginRight="12dp"
                android:layout_marginTop="338dp"
                android:rotation="-90"
                />

        </FrameLayout>

:

enter image description here

0

All Articles