欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

類似iphone的短消息效果

系統 1924 0
網上借的
類似iphone的短消息效果
    
package com.ql.app;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;

public class ChatActivity extends Activity {
	
	private ChattingAdapter adapter;
	private List<ChatMessage> messages = new ArrayList<ChatMessage>();
	private ListView listView;
	private Button btn_send;
	private EditText textEditor;
	private ImageView btn_insert;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        messages.add(new ChatMessage(ChatMessage.MESSAGE_FROM, "hello,android."));
        messages.add(new ChatMessage(ChatMessage.MESSAGE_TO, "hello,java."));
        messages.add(new ChatMessage(ChatMessage.MESSAGE_FROM, "請教高手,怎么可以給gridview設置邊框啊,現在這個顯示效果實在太難看了。"));
        messages.add(new ChatMessage(ChatMessage.MESSAGE_TO, "那就加點背景,加點屬性什么的不就行了嗎"));
        messages.add(new ChatMessage(ChatMessage.MESSAGE_FROM, "在主題中,將gridview的cssclass設置為gridview"));
        messages.add(new ChatMessage(ChatMessage.MESSAGE_TO, "謝謝"));
        listView=(ListView)findViewById(R.id.listView);
        adapter = new ChattingAdapter(this, messages);
        listView.setAdapter(adapter);
		
        btn_send = (Button) findViewById(R.id.btn_send);
		textEditor = (EditText) findViewById(R.id.text_editor);
		
		btn_insert=(ImageView) findViewById(R.id.btn_insert);
		btn_send.setOnClickListener(listener);
		btn_insert.setOnClickListener(listener);
    }
    
    
    private View.OnClickListener listener = new View.OnClickListener() {

		@Override
		public void onClick(View v) {
			switch (v.getId()) {
			case R.id.btn_send:
				String str = textEditor.getText().toString();
				String sendStr=str.trim();
				if(!sendStr.equals("")){
					sendMessage(sendStr);
				}
				textEditor.setText("");
				break;
			case R.id.btn_insert:
				Intent i = new Intent();
				i.setType("image/*");
				i.setAction(Intent.ACTION_GET_CONTENT);
				startActivityForResult(i, Activity.DEFAULT_KEYS_SHORTCUT);
				
//				Intent it = new Intent("android.media.action.IMAGE_CAPTURE");
//				startActivityForResult(it, Activity.DEFAULT_KEYS_DIALER);
				break;
			default:
				break;
			}
		}

		// 模擬發送消息
		private void sendMessage(String sendStr) {
			messages.add(new ChatMessage(ChatMessage.MESSAGE_TO, sendStr));
			adapter.notifyDataSetChanged();
		}

	};
	
    
    
}

  

    
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:focusable="false" 
	android:focusableInTouchMode="false" 
	android:background="@drawable/nav_page"
	android:gravity="center_horizontal"
    >
     <ListView 
    	android:id="@+id/listView" 
    	android:background="@null" 
    	android:scrollbars="vertical" 
    	android:layout_width="fill_parent" 
    	android:layout_height="wrap_content" 
    	android:listSelector="@null" 
    	android:transcriptMode="alwaysScroll" 
    	android:cacheColorHint="#00000000" 
    	android:divider="@null" 
    	android:layout_weight="1.0" 
    	/>
    	<LinearLayout 
    	android:orientation="horizontal" 
    	android:layout_width="fill_parent" 
    	android:layout_height="wrap_content"
    	android:background="@drawable/txt_msg_bg" 
    	android:paddingRight="7.0dip" 
    	>
        <ImageView 
        	android:id="@+id/btn_insert" 
        	android:layout_gravity="center_vertical" 
        	android:paddingLeft="15.0dip" 
        	android:paddingTop="5.0dip" 
        	android:paddingRight="7.0dip" 
        	android:paddingBottom="5.0dip" 
        	android:layout_width="wrap_content" 
        	android:layout_height="wrap_content" 
        	android:src="@drawable/sms_insert" 
        	/>
        <EditText
        	android:id="@+id/text_editor" 
        	android:layout_width="0.0dip" 
        	android:layout_height="wrap_content" 
        	android:layout_gravity="center_vertical" 
        	android:background="@drawable/sms_embeded_text_editor_bg" 
        	android:focusable="true" 
        	android:nextFocusRight="@+id/send_button" 
        	android:layout_marginLeft="7.0dip" 
        	android:layout_marginTop="5.0dip" 
        	android:layout_marginRight="7.0dip" 
        	android:layout_marginBottom="5.0dip" 
        	android:minHeight="34.0dip" 
        	android:hint="輸入消息" 
        	android:maxLines="8" 
        	android:maxLength="2000" 
        	android:capitalize="sentences" 
        	android:autoText="true" 
        	android:layout_weight="1.0" 
        	android:inputType="textCapSentences|textAutoCorrect|textMultiLine|textShortMessage" 
        	android:imeOptions="actionSend|flagNoEnterAction" 
        	/>
        <Button 
        	android:id="@+id/btn_send" 
        	android:layout_width="wrap_content" 
        	android:layout_height="wrap_content" 
        	android:gravity="center" 
        	android:layout_gravity="center_vertical" 
        	android:background="@drawable/sms_send_button_bg" 
        	android:paddingLeft="11.0dip" 
        	android:paddingRight="11.0dip" 
        	android:nextFocusLeft="@id/text_editor" 
        	/>
     </LinearLayout>
</LinearLayout>

  


整個工程:

類似iphone的短消息效果


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 99riav9.vip| 看了让人下面流水的视频 | 亚洲美女综合 | 91福利小视频 | 香蕉久久一区二区不卡无毒影院 | 天天插天天狠天天透 | 9191精品国产免费不久久 | 魔法骑士在线观看免费完整版高清 | 亚洲国产精品久久久久666 | 国产精品不卡一区 | 久久福利在线 | 国产精品国产三级在线专区 | 日韩欧美视频在线一区二区 | 日韩精品在线视频 | 美乃雀中文字幕在线一区 | 国产精品三级a三级三级午夜 | 国产国产成人久久精品杨幂 | 精品小视频 | 日韩视频在线播放 | 久久久中文 | 国产午夜精品一区二区三区嫩草 | 国内久久久久影院精品 | 久久精品一区二区免费播放 | 日韩极品视频 | 久久免费看少妇高潮A片麻豆 | 成人亚洲综合 | 狠狠操麻豆 | 一区二区日韩 | 久爱视频www在线播放 | 九九热这里 | 亚洲一区二区国产 | 香蕉久久一区二区不卡无毒影院 | 久久久精品免费热线观看 | 成人性生活视频在线播放 | 国产成人免费高清激情视频 | 久久99国产精品免费网站 | 99av涩导航| 五月婷婷综合网 | 午夜色大片在线观看 | 黄视频网站免费观看 | 国产日韩精品一区 |