Reputation: 1884
I'm trying to add a spinner/progress bar
into the left side of a TextView
.
________________
| O MY TEXT |
|________________|
O = spinner/progress bar
At first my thought was to add a TextView
and add a ProgressBar
on top of it. Is it possible to do this in a TextView
itself? if not what's best way to do this?
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/latlongLocation"
android:layout_width="150dp"
android:layout_height="23dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="21dp"
android:background="@drawable/black"
android:gravity="center"
android:singleLine="true"
android:textColor="#202020"
android:textSize="11sp" />
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
</RelativeLayout>
Upvotes: 2
Views: 1688
Reputation: 4702
Use FrameLayout. With it you can place views like in card stack.
Little example:
<!-- Example of parent -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/black">
<ProgressBar
style="@android:style/Widget.ProgressBar.Large"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="90dp"
android:layout_marginTop="20dp"
android:textSize="32dp"
android:textColor="@android:color/white"
android:text="Test text"/>
</FrameLayout>
</LinearLayout>
Would look like this
Upvotes: 5