zoukankan      html  css  js  c++  java
  • 一个好看一点的listview

         只是一个比平常的listview好看一点而已:

    主要是几个布局文件:

       main.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >
        <!-- content栏 -->
        <ListView
            android:id="@+id/listview" 
            android:layout_width="260dp" 
            android:layout_height="wrap_content"  
            android:orientation="vertical" 
            android:layout_margin="10dp" 
            android:layout_gravity="center_horizontal" 
            android:background="@drawable/shape_block"
            />
    
    </LinearLayout>

    listitem.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content" >
      
      <ImageView android:id="@+id/item_left" 
                   android:layout_width="wrap_content" 
                   android:layout_height="wrap_content" 
                   android:layout_gravity="center_vertical"
                   />
      <TextView android:id="@+id/item_text" 
                  android:layout_width="wrap_content" 
                  android:layout_height="wrap_content" 
                  android:textColor="@color/white" 
                  android:layout_gravity="center_vertical" 
                  android:gravity="left"
                  android:textStyle="bold" 
                  android:textSize="16sp" 
                  android:layout_weight="0.6" 
                  android:layout_marginLeft="10dp"/>
    
      <ImageView android:id="@+id/item_right" 
                   android:layout_width="wrap_content" 
                   android:layout_height="wrap_content" 
                   android:layout_gravity="center_vertical" 
                   android:layout_marginRight="15dp" 
                   />
                  
    </LinearLayout>

    然后在values的文件下面再写布局文件

    :array.xml

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
    
        <string-array name="menu">
            <item>one</item>
            <item>two</item>
            <item>three</item>
            <item>four</item>
            <item>five</item>
        </string-array>
            
    </resources>

    colors.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <color name="white">#FFFFFFFF</color>
        <color name="transparency">#00000000</color>
        <color name="title_bg">#FF9ed913</color>
        <color name="end_color">#A0cfef83</color>
    </resources>

       ok啦!

    一切只是为了充实自己!!stay hungry and stay foolish!!
  • 相关阅读:
    运维实战:两台服务器http方式共享yum软件仓库
    初始化thinkphp6.0出现的问题解决
    记一次续签SSL证书导致微信小程序部分机型无法访问网站接口
    微信小程序-订阅消息验证发送值有效格式
    微信小程序分包优化
    MySQL timeout 参数详解
    mysql 事件
    springboot 远程拉取配置中心配置
    使用springboot的resttmplate请求远程服务的时候报 403问题
    for 循环 与增强的for循环 经验小结
  • 原文地址:https://www.cnblogs.com/Catherine-Brain/p/3560186.html
Copyright © 2011-2022 走看看