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!!
  • 相关阅读:
    PHP琐碎学习
    php输出echo、print、print_r、printf、sprintf、var_dump比较
    跨域
    react中配置路径别名
    react antd less(3.11.1) less-loader(5.0.0) webpack(4.42.0)设置antd的主题
    babel-plugin-import配置babel按需引入antd模块
    react配置less步骤
    react配置less后浏览器报错npm install @babel/core @babel/preset-env node_moduleswebpackhotdev-server.js: Cannot find module '@babel/helper-create-regexp-features-plugin'
    win10配置Java环境变量
    关于自定义组件的组件命名规范
  • 原文地址:https://www.cnblogs.com/Catherine-Brain/p/3560186.html
Copyright © 2011-2022 走看看