0

I have a TextView on top of ProgressBar. When ProgressBar changes then the position of the TextView have to change on top of progression. How can I create such a solution?

Output :

enter image description here

Gowthaman M
  • 8,057
  • 8
  • 35
  • 54
Afinas EM
  • 2,755
  • 1
  • 15
  • 28

2 Answers2

0

Follow this

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/rl"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="10dp"
    tools:context=".MainActivity"
    android:background="#d6e6de"
    >
    <Button
        android:id="@+id/btn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Create ProgressBar"
        />
    <Button
        android:id="@+id/btn_start"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Start Operation"
        android:layout_toRightOf="@id/btn"
        />
    <TextView
        android:id="@+id/tv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/btn_start"
        />
</RelativeLayout>

Refer this below examples..

https://android--code.blogspot.in/2015/08/android-create-progressbar.html

and

How to animate the textview (very very long text )scroll automatically horizontally

Gowthaman M
  • 8,057
  • 8
  • 35
  • 54
0

Try using progressBar getProgress method and then change the text with setText method!

int state = progressBar.getProgress();
textView.setText(state);