仿小米短信发送界面
来源:互联网 发布:mac官网中文版 编辑:程序博客网 时间:2024/05/04 15:36
我们先来看一下实现效果图
联系人输入框里有标签式的View,把不同的联系人分割开,要重写EditText吗?
其实不必的,时间久了,你就会发现,很多你看到的View并不是你想的那这样
我们可以用LinearLayout(其他也可以,看个人爱好)来做这个输入框,然后addView联系人标签,最后添加一个EditText
1、这是输入联系人布局
<RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="match_parent" android:layout_height="50dp" android:background="#333" > <ImageButton android:id="@+id/back" android:layout_width="wrap_content" android:layout_height="match_parent" android:background="@null" android:paddingLeft="8dp" android:paddingRight="8dp" android:src="@drawable/back" android:textColor="#f0f0f0" /> <LinearLayout android:id="@+id/contacts_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginBottom="5dp" android:layout_marginTop="5dp" android:layout_toLeftOf="@+id/contacts" android:layout_toRightOf="@+id/back" android:background="@drawable/circle" android:gravity="center_vertical" android:orientation="horizontal" android:weightSum="1" > <EditText android:id="@+id/contacts_input" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginLeft="5dp" android:background="@null" android:minWidth="10dp" android:singleLine="true" /> </LinearLayout> <ImageButton android:id="@+id/contacts" style="?android:attr/buttonStyleSmall" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:background="@null" android:src="@drawable/contacts" /> </RelativeLayout>
2、这是添加联系人标签代码
private void addContacts(String name) {mContactsLayout.addView(initContactsItemView(name),mContactsLayout.getChildCount() - 1);}
private View initContactsItemView(String name) {final View view = LayoutInflater.from(this).inflate(R.layout.item_contacts,null);TextView textView = (TextView) view.findViewById(R.id.name);ImageButton button = (ImageButton)view.findViewById(R.id.delete);button.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View v) {// TODO Auto-generated method stubmContactsLayout.removeView(view);}});textView.setText(name);return view;}
差不多就是这些了,具体看代码吧
NewMessage.rar
1 0
- 仿小米短信发送界面
- 仿小米私密短信
- 短信发送客户端界面
- 仿小米增加短信的收藏功能
- J2ME:模拟短信发送界面
- J2Me编写界面发送短信
- android-自定义发送短信界面
- 最新调用短信界面发送短信
- ScrollView反弹效果 仿小米私密短信效果
- ScrollView反弹效果 仿小米私密短信效果
- ScrollView反弹效果 仿小米私密短信效果
- ScrollView反弹效果 仿小米私密短信效果
- ScrollView反弹效果 仿小米私密短信效果(转)
- ScrollView反弹效果 仿小米私密短信效果
- ScrollView反弹效果 仿小米私密短信效果
- android调用系统发送短信 和 已发送短信界面
- 利用RecyclerView高仿小米联系人列表界面
- iphone 如何显示短信发送界面
- Qt 5.2+VS2012+OpenCV 2.4.7的环境配置
- VC++ com编程错误之0xC0000005: 读取位置 0xfeeefef6 时发生访问冲突
- 如何使用TI提供的图像处理库?
- warning:no newline at end of file
- Lesson_for_java_day04--java基本知识、概念、变量、基本数据类型、运算符及表达式
- 仿小米短信发送界面
- 造成segmentation fault的可能原因分析
- ArcGIS API for Javascript 应用开发入门
- hdu1114
- 一个优秀的网站分析网站
- C#关系运算符与逻辑运算符
- BZOJ 1206 [HNOI2005] 虚拟内存 题解
- GPIO配置笔记
- Failed to get local InetAddress for VMID