Bonjour j’aimerais savoir comment faire tourner ma progressbarre automatiquement. Je voudrais rentrer un chiffre pour qu’elle tourne(se remplisse) et m’affiche se chiffre. Je vous fournie le code et le xml .Je voudrais le faire via un EditText et apres via un TextViev qui tapera dans ma base de données et prendra la valeur en question
Main2
1 2 3 4 5 6 7 8 9 10 11 12 13 | public class Main2Activity extends AppCompatActivity { EditText valeur=null; ProgressBar myprogressBar; TextView progressingTextView; int i = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); myprogressBar = (ProgressBar) findViewById(R.id.progressBar); progressingTextView = (TextView) findViewById(R.id.progress_circle_text); }} |
XML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_mpx" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.suprem.aswitch.Main2Activity"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:background="#fff" android:gravity="center_horizontal" android:orientation="vertical" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" android:layout_marginTop="60dp"> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_marginTop="16dp" android:text="MPX valeurs" android:textSize="18sp" android:textStyle="bold" /> <ProgressBar android:id="@+id/progressBar" style="?android:attr/progressBarStyleHorizontal" android:layout_width="200dp" android:layout_height="200dp" android:layout_marginTop="26dp" android:background="@drawable/circle_shape" android:indeterminate="false" android:max="150" android:progress="0" android:progressDrawable="@drawable/circular_progress_bar" /> <TextView android:id="@+id/progress_circle_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:background="@android:color/transparent" android:gravity="center" android:text="0" android:textColor="@color/colorPrimary" android:textSize="30sp" android:textStyle="bold" /> </RelativeLayout> </LinearLayout> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:inputType="number" android:ems="10" android:layout_alignBottom="@+id/linearLayout2" android:layout_alignParentEnd="true" android:layout_marginEnd="51dp" android:layout_marginBottom="263dp" android:id="@+id/editText5" /> <TextView android:text="TextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_toStartOf="@+id/progress_circle_text" android:layout_marginTop="86dp" android:id="@+id/textView2" tools:text="55" /> </RelativeLayout> |
+0
-0