我有一個ProgressBar,它是一個帶有TextView的微調控件,它們都在相同的相關佈局中。這些是進度的和TextView中的屬性:無法將TextView放在ProgressBar上方
<TextView
android:id="@+id/txtvStatusCircle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/progressCircle"
android:layout_centerInParent="true"
android:text="Preparing..."
android:textSize="18dip" />
<ProgressBar
android:id="@+id/progressCircle"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
在這個例子中Eclipse的節目,它看起來我想要的方式,但是當我運行它,TextView的不顯示在所有。我打斷了我的想法!當我從TextView中刪除上述部分時,會顯示該部分,但顯然不在ProgressBar上方。 爲什麼它不工作?在某處你的相對佈局正確
<ProgressBar
android:id="@+id/progressCircle"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
<TextView
android:id="@+id/txtvStatusCircle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/progressCircle"
android:layout_centerInParent="true"
android:text="Preparing..."
android:textSize="18dip" />
有一件事我忘了告訴(不要認爲它有所作爲)。我不使用它作爲一個正常的佈局,但我用它作爲'AlertDialog'中的佈局,所以使用'.setView()' – Xander
這個方法實際上這確實改變了一些東西。現在我遇到了和你一樣的問題;)這有點奇怪,也許你應該爲這兩個元素使用LinearLayout並居中。 – reVerse
那就是tric!謝謝!! – Xander