Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android progressbar inside edittext

I want to display progressbar(spinner) to the right of editText when activity is doing some processing and hide upon completion, is there a simple way to do this?

like image 779
mkso Avatar asked Dec 20 '10 20:12

mkso


2 Answers

I'd use RelativeLayout, something like this:

<RelativeLayout>
    <EditText
        android:id="@+id/the_id"/>
    <ProgressBar
        style="?android:attr/progressBarStyleSmall"
        android:layout_alignTop="@id/the_id"
        android:layout_alignBottom="@id/the_id"
        android:layout_alignRight="@id/the_id"/>
</RelativeLayout>
like image 73
Cristian Avatar answered Oct 13 '22 00:10

Cristian


Try this...

<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" >

             <EditText
                android:id="@+id/editText"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="8dp"
                android:ems="10"
                android:hint="@string/app_name"
                android:inputType="textNoSuggestions"
                android:padding="8dp" >
             </EditText>

             <ProgressBar
                  style="?android:attr/progressBarStyleInverse"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_alignBottom="@id/editText"
                  android:layout_alignRight="@id/editText"
                  android:layout_alignTop="@id/editText" />
             </RelativeLayout>
        </LinearLayout>
like image 40
Silambarasan Poonguti Avatar answered Oct 12 '22 22:10

Silambarasan Poonguti