1
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="horizontal"
   android:gravity="center"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content">


<ProgressBar android:id="@+android:id/progress_small"
    style="?android:attr/progressBarStyleSmall"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

<TextView android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:textSize="15sp"
   android:gravity="center"
   android:text="LOREM IPSUM BAB BABALOREM IPSUM BAB BABALOREM"
   />

</LinearLayout>

ここに画像の説明を入力

Lorem の L とプログレス バーの間のギャップを削除するにはどうすればよいですか? テキストを中央揃えのみにしたい。

テキストビューの幅はラップコンテンツです。しかし、両側にギャップがあります。それを取り除く方法は?

どちらも私はそれを単一行にするつもりはありません。表示されている単語を見逃したくないので。

どちらも私はそれを左揃えにするつもりはありません

4

4 に答える 4

1

あなたのtextViewでこの変更を行います::

<TextView android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:textSize="15sp"
          android:gravity="center"
          android:singleLine="True"  
          android:text="LOREM IPSUM BAB BABALOREM IPSUM BAB BABALOREM"/>
于 2012-12-05T11:41:54.317 に答える
0
style="?android:attr/progressBarStyleSmall"
android:layout_width="0dp"
android:layout_weight="1"

progressBar の重みを 1 に設定し、幅を 0dp に設定すると、目的の結果を得ることができますが、すべての画面サイズで機能することを保証することはできません

編集:

上記の変更により、目的の出力を得ることができました。

上記の変更の結果

于 2012-12-05T12:05:37.443 に答える
0

試す

android:gravity="center|left"
于 2012-12-05T11:56:10.043 に答える
0

これを使ってみてください:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content">


<ProgressBar android:id="@+id/ProgressDisplay"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_toRightOf="@id/ProgressDisplay"
    android:gravity="left"
    android:text="LOREM IPSUM BAB BABALOREM IPSUM BAB BABALOREM"
    android:textSize="15sp" />

</RelativeLayout>
于 2012-12-05T12:45:32.430 に答える