S
S
Sergey2017-10-15 11:10:55
Android
Sergey, 2017-10-15 11:10:55

How to make two progressbar one after the other?

Good afternoon, I'm new to programming, so please don't scold me too much. Tell me how to make two progressbar one after the other? That's what; it is necessary that one would show the actual temperature, and the one that is set on the back so that the difference can be seen. Can this be done? found an example online

Layout :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:padding="20dp">
 <ProgressBar
  style="@android:style/Widget.ProgressBar.Horizontal"
  android:layout_centerInParent="true"
  android:layout_width="15dp"
  android:layout_height="match_parent"
  android:max="100"
  android:progress="33"
  android:progressDrawable="@drawable/progress_drawable" />
</RelativeLayout>

progress_drawable :
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
 <item android:id="@android:id/background">
  <color android:color="#777" />
 </item>
 <item android:id="@android:id/progress">
  <clip
   android:clipOrientation="vertical"
   android:gravity="bottom">
   <shape>
    <gradient
     android:startColor="#00FF00"
     android:centerColor="#FFFF00"
     android:endColor="#FF0000"
     android:angle="90" />
   </shape>
  </clip>
 </item>
</layer-list>

How to add a progressbar to the background?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
aol-nnov, 2017-10-15
@aol-nnov

we would have a diagram, or a drawing,
we would have arranged a vertezh
, but so, search as much as you want, you
will find a bald devil
© L. Filatov
, questions immediately arise here. For example:
and if the actual temperature (suddenly) turns out to be higher than the set one, it will not be visible in any way!
first, open your mana and read about progress and secondaryProgress.

S
Sergey, 2017-10-15
@sergei_kot

Here it seems that what you need turned out, one problem Edittext goes beyond the screen ( At the bottom, under the progressbarom, you need an edittext in which the temperature will be entered. Help please?

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="asv_lab.ru.smarttemp.MainActivity"
    tools:showIn="@layout/main">

    <GridLayout
        android:id="@+id/gridmain"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginBottom="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        android:alignmentMode="alignMargins"
        android:columnCount="4"
        android:orientation="horizontal"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent">


        <ProgressBar
                android:id="@+id/prg0"
                style="@android:style/Widget.ProgressBar.Horizontal"
                android:layout_width="60dp"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:layout_weight="10"
                android:layout_column="1"
                android:layout_row="1"
                android:max="100"
                android:progress="33"
                android:progressDrawable="@drawable/prgbarv1" />


        <ProgressBar
            android:id="@+id/prg1"
            style="@android:style/Widget.ProgressBar.Horizontal"
            android:layout_width="40dp"
            android:layout_height="match_parent"
            android:layout_column="1"
            android:layout_gravity="center"
            android:layout_row="1"
            android:layout_weight="0.5"
            android:max="100"
            android:progress="34"
            android:progressDrawable="@drawable/prgbarv" />

        <EditText
            android:id="@+id/editText3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="1"
            android:layout_row="2"
            android:ems="3"
            android:inputType="number" />


    </GridLayout>
</android.support.constraint.ConstraintLayout>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question