Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>One solution I implemented for displaying the text on top of the progress bar is to use a FrameLayout like below:</p> <pre><code>&lt;TableRow&gt; &lt;!-- First cell with progress and text on top --&gt; &lt;FrameLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" &gt; &lt;ProgressBar android:id="@+id/progress1" android:progressDrawable="@drawable/progress_bg" android:indeterminateOnly="false" android:indeterminate="false" android:minHeight="22dp" android:max="100" android:progress="25" android:layout_width="fill_parent" android:layout_height="wrap_content" /&gt; &lt;TextView android:id="@+id/progress1Text" android:text="25" android:layout_width="fill_parent" android:layout_height="22dp" android:gravity="center" /&gt; &lt;/FrameLayout&gt; &lt;!-- Second cell with some text--&gt; &lt;TextView android:text="My cell" android:layout_width="wrap_content" android:layout_height="22dp" android:gravity="center_vertical" /&gt; &lt;/TableRow&gt; </code></pre> <p>You could use this xml and inflate it in Java and set the attributes of the elements as needed then append it to your table.</p> <p>For the android:progressDrawable="@drawable/progress_bg" I used the following progress_bg.xml (placed in "drawable" floder):</p> <pre><code>&lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:id="@android:id/background"&gt; &lt;shape&gt; &lt;corners android:radius="4dp" /&gt; &lt;solid android:color="#00000000" /&gt; &lt;stroke android:width="2dp" android:color="#FFFFFFFF" /&gt; &lt;/shape&gt; &lt;/item&gt; &lt;item android:id="@android:id/secondaryProgress"&gt; &lt;clip&gt; &lt;shape&gt; &lt;corners android:radius="4dp" /&gt; &lt;solid android:color="#80CCCCCC" /&gt; &lt;stroke android:width="2dp" android:color="#FFFFFFFF" /&gt; &lt;/shape&gt; &lt;/clip&gt; &lt;/item&gt; &lt;item android:id="@android:id/progress"&gt; &lt;clip&gt; &lt;shape&gt; &lt;corners android:radius="4dp" /&gt; &lt;solid android:color="#FFCCCCCC" /&gt; &lt;stroke android:width="2dp" android:color="#FFFFFFFF" /&gt; &lt;/shape&gt; &lt;/clip&gt; &lt;/item&gt; &lt;/layer-list&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload