在Android布局中出现了扭曲的ProgressBar旋转器

4
我有一个进度旋转器,其布局如下:
<ProgressBar
        android:id="@+id/progressBar1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:paddingBottom="10dp"
        android:paddingTop="10dp" >

</ProgressBar>

它应该看起来像这样:

enter image description here

但是在一些姜饼设备上,它看起来像这样:

enter image description here

我不知道为什么在旧设备上它似乎看起来坏掉了?

编辑 完整的布局:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <WebView
        android:id="@+id/webView1"
        android:layout_width="fill_parent"
        android:layout_height="434dp"
        android:layout_weight="0.45" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_gravity="center"
        android:background="@color/background" >

        <ImageView
            android:id="@+id/left"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_weight="0.10"
            android:paddingBottom="10dp"
            android:paddingTop="10dp"
            android:src="@drawable/ic_arrowleft" />

        <ImageView
            android:id="@+id/right"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_weight="0.10"
            android:paddingBottom="10dp"
            android:paddingTop="10dp"
            android:src="@drawable/ic_arrowright" />

        <ProgressBar
            android:id="@+id/progressBar1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginBottom="10dp"
            android:layout_marginTop="10dp" >

        </ProgressBar>

        <TextView
            android:id="@+id/grabit"
            android:layout_width="0dp"
            android:layout_height="46dp"
                        android:layout_weight="0.50"

            android:layout_gravity="center"
            android:background="@color/selected"
            android:gravity="center"
            android:text="GRAB IT"
            android:textColor="#fff"
            android:textStyle="bold" />

    </LinearLayout>

</LinearLayout>
1个回答

3
不要使用内边距,改用外边距。这样写:
```CSS .selector { margin: 10px; } ```
<ProgressBar
        android:id="@+id/progressBar1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginBottom="10dp"
        android:layout_marginTop="10dp" >

</ProgressBar>

编辑: 问题是在水平线性布局中:

android:layout_height="50dp"

姜饼版本中的进度条更大,这意味着你强制它自己压缩,从而导致了扭曲。请改用wrap_content。

仍然遇到相同的问题。 - DevWithZachary
你能发布你的整个布局吗? - Ryan S

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接