我有一個正常的相對佈局,文本視圖和進度條。Android擴展和佈局合同動畫
現在,因爲我有一個固定的寬度和高度的佈局文本正確地放置在中心和看起來不錯,佈局onclick我們正在改變進度欄的可見性,以「可見」,但因爲我有一個固定寬度的進度條位於文本的頂部。
我想要實現的是,onclick和動畫一起增加布局的右端寬度。
這裏是我的代碼:佈局
<RelativeLayout
android:id="@+id/rellyt"
android:layout_width="150dp"
android:layout_height="35dp"
android:layout_margin="5dp"
android:background="#B7E4FF"
android:clickable="true" >
<TextView
android:id="@+id/txt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:text="click on this button"
android:textColor="#000000"
android:textSize="14sp" />
<ProgressBar
android:id="@+id/prgbar"
style="@android:style/Widget.ProgressBar.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="8dp"
android:visibility="visible" />
</RelativeLayout>
屏幕截圖:
機器人:layout_gravity =浮動在CSS 安卓重力=在CSS文本對齊...............使用這些屬性來設置文本查看,因爲當你動畫..你的textView將取代.. – Nepster 2014-09-02 08:00:03
@Nepster你能詳細說明嗎? – Goofy 2014-09-02 08:18:07
右端寬度意味着你必須增加你的RelativeLayout的填充權。 – Nepster 2014-09-02 08:23:40