我正在嘗試將spinner/progress bar
添加到TextView
的左側。將微調器/進度條添加到文本視圖中?
________________
| O MY TEXT |
|________________|
O = spinner/progress bar
起初,我想到的是增加一個TextView
,並在其頂部添加ProgressBar
。是否有可能在TextView
本身做到這一點?如果不是這樣做的最好方法是什麼?
<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>
有你爲什麼在你的佈局硬編碼保證金和部件尺寸特殊的原因?您可以使用樣式/維度資源來保持應用程序的一致性。關於文本顏色或繪圖也是如此。 – 2Dee
@ 2Dee我是Android SDK的新手,謹慎幫助我糾正我的代碼? –