Android不确定进度条有奇怪的行

时间:2018-02-08 00:54:36

标签: android android-progressbar

我实施了一个interdeterminate进度条,就像他们在这里一样: http://www.zoftino.com/android-progressbar-and-custom-progressbar-examples

我用这段代码设计了它:

styles.xml

<div id="key" style="text-align: justify;">
  <ol>
    <li>
      <ol class="list">
        <li class="list-item"><span class="text">This is A in the first couplet and this is fine</span><span class="number">2</span></li>
        <li class="list-item"><span class="text">This is B in the first couplet and this is fine</span><span class="number">4</span></li>
      </ol>
    </li>
    <li>
      <ol class="list">
        <li class="list-item"><span class="text">This is A in the second couplet and this is not fine</span> <span class="number">3</span></li>
        <li class="list-item"><span class="text">This is B in the second couplet and this is overlapping A - not fine</span> <a href="https://www.website.org/fish/thunnus-obesus/"><span class="number"><em>Thunnus obesus</em> (bigeye tuna)</span></a></li>
        <li class="list-item"><span class="text">This is C in the second couplet and although not overlapping B it doesnt have padding below</span> <a href="https://www.fishider.org/scombridae/thunnus-albacares/"><span class="number"><em>Thunnus albacares</em> (yellowfin tuna)</span></a></li>
      </ol>
    </li>
    <li>
      <ol class="list">
        <li class="list-item"><span class="text">This is A in the third couplet and this is not fine</span> <a href="https://www.website.org/fish/thunnus-tonggol/"><span class="number"><em>Thunnus tonggol</em> (longtail tuna)</span></a></li>
        <li class="list-item"><span class="text">This is B in the third couplet and this is overlapping A - not fine</span><a href="https://www.website.org/fish/thunnus-maccoyii/"><span class="number"><em>Thunnus orientalis</em> (Pacific bluefin tuna)</span></a></li>
        <li class="list-item"><span class="text">This is C in the third couplet and this is overlapping b - not fine </span><a href="https://www.website.org/fish/thunnus-maccoyii/"><span class="number"><em>Thunnus maccoyii</em> (southern bluefin tuna)</span></a></li>
        <li class="list-item"><span class="text">This is D in the third 'couplet' and although its not overlapping C it doesn't have padding below </span><a href="https://www.website.org/fish/thunnus-alalunga/"><span class="number"><em>Thunnus alalunga</em> (albacore tuna)</span></a></li>
      </ol>
    </li>
  </ol>
</div>

progressspinner.xml

<style name="MyProgressBarSpinner" parent="@style/Widget.AppCompat.ProgressBar">
    <item name="android:indeterminateDrawable">@drawable/progressspinner</item>
    <item name="android:minHeight">80dp</item>
    <item name="android:minWidth">200dp</item>
</style>

现在的问题是,我从进度条中的两个环中得到了这些奇怪的线条,我无法弄清楚如何防止这种情况。你可以在这张图片上看到它:

enter image description here

感谢您的建议。

1 个答案:

答案 0 :(得分:1)

从spinner xml中删除以下两行代码。

  

机器人:顶=&#34; 16DP&#34;

     

机器人:底部=&#34; 16DP&#34;

这是在您遇到问题的进度条中添加额外的行。

  <?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@android:id/progress">
        <layer-list>
            <item>
                <rotate
                    android:fromDegrees="0"
                    android:toDegrees="360">
                    <shape
                        android:innerRadiusRatio="2.3"
                        android:shape="ring"
                        android:thickness="3.8sp"
                        android:useLevel="true">
                        <solid
                            android:width="1dp"
                            android:color="#79bac6"/>
                    </shape>
                </rotate>
            </item>
            <item>
                <rotate
                    android:fromDegrees="90"
                    android:toDegrees="180">
                    <shape
                        android:innerRadiusRatio="2.3"
                        android:shape="ring"
                        android:thickness="3.8sp"
                        android:useLevel="true">
                        <solid
                            android:width="1dp"
                            android:color="#7985c6"/>
                    </shape>
                </rotate>
            </item>
            <item
                android:width="60dp"
                android:height="60dp"
                android:gravity="center"
                >
                <rotate
                    android:fromDegrees="360"
                    android:pivotX="50%"
                    android:pivotY="50%"
                    android:toDegrees="0">
                    <bitmap android:src="@drawable/ic_launcher">
                    </bitmap>
                </rotate>
            </item>
        </layer-list>
    </item>
</layer-list>

如何让我的图片更小?

为此,您必须使用项目宽度和高度参数与重力。

示例:

<item
     android:width="60dp"
     android:height="60dp"
     android:gravity="center">