2 yxts122 YXTS122 于 2016.09.12 20:34 提问

聊天背景的点9图怎么做?

因我要做这个聊天界面,需要搞个气泡的点9图片,但我不知道该怎么操作?
http://bbs.csdn.net/topics/392017626

图片说明
求救,怎么操作?

4个回答

u012436608
u012436608   2016.09.14 09:43
已采纳

上边 和左边 点的点代表拉伸区域 右边 和下边画线表示文字的显示区域

YXTS122
YXTS122 我想问的是我该用鼠标具体怎么操作?能示范一遍给我看吗?或者有相关的视频么?
大约一年之前 回复
YXTS122
YXTS122   2016.09.15 05:14

图片说明

图片说明
我知道了,鼠标由单箭头变为双箭头

YXTS122
YXTS122   2016.11.25 06:51

title.xml

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    tools:context="com.example.ch02_qipao.MainActivity"
    android:orientation="horizontal"
    android:background="#ffc0cb">

    <Button 
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:text="@string/fanhui"
        android:textSize="15sp"/>

    <TextView 
        android:layout_width="0dp"
        android:layout_weight="2"
        android:gravity="center"  
        android:layout_height="match_parent"
        android:text="@string/liao"
        android:textSize="15sp"/>

    <Button 
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:text="@string/xinjian"
        android:textSize="15sp"/>

</LinearLayout>

YXTS122
YXTS122   2016.11.25 06:57

MainActivity.java

 package com.example.ch02_qipao;


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

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.Toast;

public class MainActivity extends Activity implements OnClickListener {
    private ListView msgListView;
    private EditText inputText;
    private Button send;
    private Button receive;
    private MsgAdapter adapter;
    private List<Msg> msgList=new ArrayList<Msg>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_main);
        initMsgs();
        adapter=new MsgAdapter(MainActivity.this,R.layout.msg_item,msgList);
        inputText=(EditText)findViewById(R.id.input_text);
        send=(Button)findViewById(R.id.send);
        receive=(Button)findViewById(R.id.receive);
        msgListView=(ListView)findViewById(R.id.msg_list_view);
        msgListView.setAdapter(adapter);
        send.setOnClickListener(this);
        receive.setOnClickListener(this);
    }

    private void initMsgs() {
        Msg msg1=new Msg("你好!",Msg.TYPE_RECEIVED);
        msgList.add(msg1);
        Msg msg2=new Msg("你好!",Msg.TYPE_SENT);
        msgList.add(msg2);
    }

    @Override
    public void onClick(View v)
    {
    String content=inputText.getText().toString().trim();
    switch (v.getId())
    {
    case R.id.send:
        if(!"".equals(content)) {
            Msg msg=new Msg(content,Msg.TYPE_SENT);
            msgList.add(msg);
            adapter.notifyDataSetChanged();
            msgListView.setSelection(msgList.size());
            inputText.setText("");
        }
        else {
            Toast toast1=Toast.makeText(getApplicationContext(),"不能发送空内容!",Toast.LENGTH_SHORT);
            toast1.show();
        }
        break;
    case R.id.receive:
        if(!"".equals(content)) {
            Msg msg=new Msg(content,Msg.TYPE_RECEIVED);
            msgList.add(msg);
            adapter.notifyDataSetChanged();
            msgListView.setSelection(msgList.size());
            inputText.setText("");
        }
        else {
            Toast toast1=Toast.makeText(getApplicationContext(),"不能发送空内容!",Toast.LENGTH_SHORT);
            toast1.show();
        }
        break;
    }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}


activity_main.xml

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.ch02_qipao.MainActivity" 
    android:background="#d8e0e8"
    android:orientation="vertical">

    <include 
        layout="@layout/title" />

    <ListView
        android:id="@+id/msg_list_view"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:divider="#ffc0cb">

    </ListView>

    <LinearLayout 
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <Button 
            android:id="@+id/receive"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/send"/>

        <EditText 
            android:id="@+id/input_text"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="2"
            android:hint="@string/something"
            android:maxLines="3"/>

        <Button 
            android:id="@+id/send"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/send"/>

    </LinearLayout>

</LinearLayout>

msg_item.xml

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.ch02_qipao.MainActivity" 
    android:background="#d8e0e8"
    android:orientation="vertical">

    <LinearLayout 
        android:id="@+id/left_layout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="left"
        android:background="@drawable/left">

        <TextView 
            android:id="@+id/left_msg"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:textColor="#fff"
            android:background="#ffc0cb"/>
    </LinearLayout>


    <LinearLayout 
        android:id="@+id/right_layout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="right"
        android:background="@drawable/right">

        <TextView 
            android:id="@+id/right_msg"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:textColor="#fff"
            android:background="#ffc0cb"/>
    </LinearLayout>

</LinearLayout>  

图片说明
图片说明

Csdn user default icon
上传中...
上传图片
插入图片