40、流量统计--界面设计

这里联系使用抽屉控件SlidingDrawer,布局文件:

<?xml version="1.0" encoding="utf-8"?>

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

    <TextView style="@style/title_center_text"
        android:text="流量统计"/>
    <View style="@style/splitter_view"/>

    <SlidingDrawer
        android:content="@+id/content"
        android:handle="@+id/handle"
        android:layout_height="match_parent"
        android:layout_width="match_parent">
        <ImageView
            android:id="@id/handle"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:src="@drawable/notification"/>
        <RelativeLayout
            android:id="@id/content"
            android:layout_height="match_parent"
            android:layout_width="match_parent">
            <LinearLayout
                android:orientation="vertical"
                android:gravity="center"
                android:id="@+id/ll_loading"
                android:layout_height="match_parent"
                android:layout_width="match_parent">
                <ProgressBar style="@style/my_pb_style"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content" />
                <TextView style="@style/commontext"
                    android:text="正在加载流量信息……"/>
            </LinearLayout>
            <ListView
                android:id="@+id/lv_traffic"
                android:layout_height="match_parent"
                android:layout_width="match_parent"/>
        </RelativeLayout>
    </SlidingDrawer>
</LinearLayout>

每一个item的布局文件参考 《37、进程管理器--界面设计》

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:id="@+id/ll_taskmanager"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <ImageView
        android:id="@+id/iv_traffic_icon"
        android:layout_height="60dip"
        android:layout_width="60dip"
        android:layout_weight="0"
        android:layout_gravity="left"/>
    <RelativeLayout
        android:layout_weight="1"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <TextView style="@style/content_text"
            android:id="@+id/tv_traffic_name"
            android:layout_alignParentTop="true"
            android:singleLine="true"
            android:ellipsize="end"
            android:textSize="20sp"/>
        <LinearLayout
            android:orientation="horizontal"
            android:layout_alignParentBottom="true"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content">
            <ImageView
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:src="@drawable/app_traffic_send"/>
            <TextView style="@style/content_text"
                android:id="@+id/tv_traffic_tx"
                android:textSize="12sp"/>
            <TextView style="@style/content_text"
                android:text="    "
                android:textSize="12sp"/>
            <ImageView
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:src="@drawable/app_traffic_down"/>
            <TextView style="@style/content_text"
                android:id="@+id/tv_traffic_rx"
                android:textSize="12sp"/>
        </LinearLayout>
    </RelativeLayout>

    <TextView style="@style/content_text"
        android:id="@+id/tv_traffic_total"
        android:textSize="12sp"/>
</LinearLayout>
运行效果图:

点击抽屉的把柄向上滑动,显示正在加载中的滚动条:

滚动条为自定义的ProgressBar,继承风格:@style/my_pb_style:

    <style name="my_pb_style" parent="@android:style/Widget.ProgressBar">
        <item name="android:indeterminateDrawable">@drawable/my_pb_bg</item>
    </style>
其中my_pb_bg.xml:

<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/notification"
    android:pivotX="50%"
    android:pivotY="50%"
 />

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

asmcvc

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值