4
在Android中創建具有兩種顏色表示形式的水平單條圖的最簡單方法是什麼? 像這樣具有雙色表示的水平單條形圖
量64%,能顯着提高獲得高達100%的及時(動畫??? :() 是SVG或圖像視圖或怎麼樣?
在Android中創建具有兩種顏色表示形式的水平單條圖的最簡單方法是什麼? 像這樣具有雙色表示的水平單條形圖
量64%,能顯着提高獲得高達100%的及時(動畫??? :() 是SVG或圖像視圖或怎麼樣?
這種佈局上面實現,在代碼中調整p3 TextView寬度(紅色背景)作爲p1的百分比TextView寬度(藍色背景)將p4 TextView文本更改爲當前百分比(考慮標籤重疊時要做的百分比達到100%,建議在p3之後設置文本值一定的限制,比如說85%,然後隱藏P4,如果增加百分比來查看UI更新,我建議使用AsyncTask(或者其他線程方法),也可以查看Android Tween動畫
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:padding="5dp">
<TextView
android:id="@+id/bar"
android:layout_width="5dp"
android:layout_height="25dp"
android:background="#FF000000" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="5dp">
<TextView
android:id="@+id/p1"
android:layout_width="220dp"
android:layout_height="wrap_content"
android:background="#FF00FFFF" />
<TextView
android:id="@+id/p2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/p1"
android:text="100%" />
<TextView
android:id="@+id/p3"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:background="#FFFF0000"
android:gravity="end" />
<TextView
android:id="@+id/p4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/p3"
android:text="64%" />
</RelativeLayout>
</LinearLayout>