【问题标题】:Cant set small size to ProgressBar (android)无法将小尺寸设置为 ProgressBar (android)
【发布时间】:2015-06-23 14:50:12
【问题描述】:

我无法设置进度条的大小。我试过这个:

style="?android:attr/progressBarStyleSmall"

还有这个:

android:maxHeight="5dp"

布局xml:

 <?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <!-- The main content view -->
    <FrameLayout
        android:id="@+id/frame_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    </FrameLayout>


       <ProgressBar
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:indeterminate="true"
        style="?android:attr/progressBarStyle"
        android:id="@+id/progress_bar"
        android:maxHeight="5dp"
        android:layout_marginRight="5dp" />

    <!-- The navigation drawer list 
        <LinearLayout
        android:id="@+id/linear_layout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="left"
        android:layout_marginTop="10dp">  
    "#368ee0" -->

    <ListView
        android:id="@+id/slider_list"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="#368ee0"
        android:textColor="#ffffff"
        android:choiceMode="singleChoice"
        android:divider="#b0e0e6"
        android:dividerHeight="1dp" />
    <!--
    </LinearLayout>-->

</android.support.v4.widget.DrawerLayout>

我在 MainActivity 中创建 ProgressBar,当我更新显示 (updateDisplay) 时,我创建一个新的 WebFragment 并将 progressBar 作为参数传递,WebFragment 然后运行一个线程,完成后将 progressBar 的可见性变为“走了”。

【问题讨论】:

    标签: android xml android-layout android-progressbar


    【解决方案1】:

    迟到总比没有好

    在进度条中检查这一行

    android:layout_height="match_parent"
    

    也许你想要

    android:layout_height="wrap_content"
    

    【讨论】:

    • 嗨,我已经尝试了 2 天,然后决定更改为另一个小部件...我使用了名为 ProgressWheel (github.com/pnikosis/materialish-progress) 的东西。这使得更改尺寸、外观等变得更加容易......无论如何,谢谢你试图帮助我,我给你投票;)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-19
    • 1970-01-01
    • 2023-01-08
    • 1970-01-01
    相关资源
    最近更新 更多