カスタム行レイアウトのリストビューがあります。このカスタム行には、読み込み状態を示す進行状況バー (「円」) があります。レイアウトを好きなように見せるために、プログレスバーと他のGUIのものを含むレイアウトにlayout_weightを使用しています。
例:
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleSmall"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="7"
android:layout_marginLeft="6dip"
android:orientation="vertical"
>
プログレスバーのアスペクト比を同じにしたい。
私の問題は、プログレスバーがさまざまなデバイスで奇妙に見えることです。私の銀河ネクサスでは、すべてがうまく見え、プログレスバーの縦横比は同じです。しかし、たとえば、私のエミュレーターでは、プログレスバーが卵のように見え、それはひどいものです。
誰かが私のエラーを指摘できますか?
編集:
レイアウトはビューの残りの部分にプログレスバーの幅を使用するため、wrap_content は使用しません。
編集2:
問題を示す 2 つの図:
「卵」 http://s14.directupload.net/file/d/2955/89xvdhrz_png.htm
wrap_content の使用 http://s1.directupload.net/file/d/2955/sryrhkkk_png.htm
編集3:
CFlex のアプローチ。xml ファイル全体
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_margin="4dp"/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="7"
android:layout_marginLeft="6dip"
android:orientation="vertical"
>
<TextView
android:id="@android:id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<TextView
android:id="@android:id/text2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"/>
</LinearLayout>