Android 控件之--发送邮件时的,收件人列表,可以自动匹配,可以删除,可以添加的。

先不管,截几个图:添加了2个Item  ,后面那个是自动匹配联想。



根据每个Item的宽度,动态计算,一行到底放多少个Item.不够放,就换行(其实不是文本编辑器里的那种换行,是新建一个LinearLayout.嘿嘿)



每个Item的初始状态是 没有那个叉叉的, 当click一下它,它就变成黄色背景,并且那个白色的叉叉出现了。



click那个叉叉,就把它删除了,而且后面的那些要自动往前排(其实这里,目前的一种方式是很粗糙的方式,直接removeAll,然后再一个个的add进去)





废话少说,直接帖代码:如下------------》

  1。先看主界面布局文件:

          

<?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" >

    <com.test.demo.MyScrollView
        android:id="@+id/mScrollView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@color/color_white"/>

</LinearLayout>

  单个Item的布局文件:
    
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:background="@color/color_light"
    android:gravity="center">

    <TextView
         android:id="@+id/itemTv"
         android:layout_width="wrap_content"
    		 android:layout_height="wrap_content">
    </TextView>

    <ImageView
        android:id="@+id/delete_iv"
        android:layout_width="wrap_content"
    		android:layout_height="wrap_content"
    		android:background="@drawable/email_delete">
    </ImageView>

</LinearLayout>

3.color.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
	<drawable name="darkgray">#808080FF</drawable>
    <drawable name="white">#FFFFFFFF</drawable>
	<drawable name=&
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值