列表视图项底部的进度条

时间:2014-12-31 10:14:43

标签: android progress-bar

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

    <ImageView
        android:id="@id/explorer_fIcon"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:contentDescription="@null"
        android:padding="3dp" />

    <TextView
        android:id="@id/explorer_fName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginRight="40dp"
        android:layout_toRightOf="@id/explorer_fIcon"
        android:ellipsize="marquee"
        android:singleLine="true"
        android:textStyle="bold" />

    <CheckBox
        android:id="@id/explorer_checkbox"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:clickable="false"
        android:focusable="false"
        android:visibility="gone" />

     <ProgressBar
        android:id="@+id/drawer_progressbar2"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:clickable="false"
        android:progress="40" /> 

</RelativeLayout>

进度条有 android:layout_alignParentBottom =&#34; true&#34; 但它不在底部

enter image description here

如何在底部制作进度条,我的意思是在分隔符的顶部?

更新:我在Listview中添加了分隔符attr:

<ListView
    android:id="@+id/left_drawer_list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:choiceMode="singleChoice"
    android:divider="@android:color/transparent"
    android:dividerHeight="0dp"
    android:fastScrollEnabled="false" />

但它仍然不起作用

更新2:非常感谢。这是我从你那里得到的最终答案:

 <ProgressBar
    android:id="@+id/drawer_progressbar2"
    style="?android:attr/progressBarStyleHorizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/explorer_fIcon"
    android:layout_marginBottom="-7dp"
    android:clickable="false"
    android:progress="40"
    android:visibility="visible" /> 

3 个答案:

答案 0 :(得分:1)

1.在Explorer图标下面显示你的进度条,并从顶部稍微边缘,

2.现在在Listview上,将分隔符高度设置为0px

3.现在你的进度条应该像分频器一样。

它应该有效,让我知道它是否有效或无效。

答案 1 :(得分:1)

ProgressBar是一个视图,其容器具有额外的填充事件,其高度设置为wrap_content。所以我认为除了给它一个减去余量之外还有其他方法;

android:layout_marginBottom="-7dp"

所以,像这样改变你的ProgressBar;

 <ProgressBar
    android:id="@id/drawer_progressbar2"
    style="?android:attr/progressBarStyleHorizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="-7dp"
    android:layout_alignParentBottom="true"
    android:clickable="false"
    android:progress="40" /> 

它应该有用。

答案 2 :(得分:0)

你可以尝试相反的方法,让分隔符消失。在你的父列表视图中xml add:

   android:dividerHeight="0dp"