欧美三区_成人在线免费观看视频_欧美极品少妇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條評論
主站蜘蛛池模板: 国产 麻豆 | 又黄又爽的成人免费网站 | 久久久久久一级毛片免费野外 | 麻豆精品传媒一二三区在线视频 | 91福利小视频 | 在线看色片 | 91短视频版官网 | 日本一级毛片视频 | 欧美特黄aaaaaa| 人人干人人干人人干 | 欧美成视频无需播放器 | 一区免费看 | 亚洲区视频 | 午夜99| 加勒比精品久久一区二区三区 | 国产综合精品久久亚洲 | 欧美一区二区三区在线观看视频 | 亚洲精品国产第一区二区多人 | 521色香蕉网站在线观看 | 国产精品高清在线观看 | av网站免费 | 国产在线欧美 | 天天天天天天天操 | 奇米777四色成人影视 | 99久久自偷自偷国产精品不卡 | 日本亚洲国产精品久久 | 日韩毛片欧美一级a网站 | 国产一级毛片高清 | 免费xxxx日本大片在线观看 | 欧美视频亚洲视频 | 亚洲一区二区三区深夜天堂 | 久久毛片网站 | 中文字幕av一区二区 | 日韩18视频在线观看 | 牛牛a级毛片在线播放 | 四虎在线视频 | 欧美99 | 久久精品一区二区三区四区 | 亚洲国产综合精品中文第一区 | 亚洲欧洲精品成人久久奇米网 | 国产色在线 |