• 大小: 1010KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-11-06
  • 语言: 其他
  • 标签: android  

资源简介

详情:http://blog.csdn.net/IT_XF/article/details/51458441

资源截图

代码片段和文件信息

package createproject.zhuoxin.edu.housekeeperdemo1.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;

import createproject.zhuoxin.edu.housekeeperdemo1.R;
import createproject.zhuoxin.edu.housekeeperdemo1.adapter.ListviewAdapter;
import createproject.zhuoxin.edu.housekeeperdemo1.entity.MsgInfo;

public class MainActivity extends AppCompatActivity implements View.onclickListener {

    private ListviewAdapter adapter = null;

    private ListView listview;
    private Button btn_left;
    private EditText et_meg;
    private Button btn_right;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();

        adapter = new ListviewAdapter(this);
        listview.setAdapter(adapter);

    }


    private void initView() {
        listview = (ListView) findViewById(R.id.listview);
        btn_left = (Button) findViewById(R.id.btn_left);
        et_meg = (EditText) findViewById(R.id.et_meg);
        btn_right = (Button) findViewById(R.id.btn_right);

        btn_left.setonclickListener(this);
        btn_right.setonclickListener(this);
    }

    @Override
    public void onclick(View v) {

        String msg = et_meg.getText().toString().trim();

        switch (v.getId()) {
            case R.id.btn_left:
                adapter.addDataToAdapter(new MsgInfo(msgnull));
                adapter.notifyDataSetChanged();
                break;
            case R.id.btn_right:
                adapter.addDataToAdapter(new MsgInfo(null msg));
                adapter.notifyDataSetChanged();
                break;
        }

        listview.smoothScrollToPosition(listview.getCount() - 1);

        et_meg.setText(““);

    }

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件     1414887  2016-05-19 16:45  chat.gif
     目录           0  2016-05-20 00:16  源码\
     文件         710  2016-05-19 16:09  源码\AndroidManifest.xml
     目录           0  2016-05-19 16:48  源码\java\
     目录           0  2016-05-19 16:48  源码\java\createproject\
     目录           0  2016-05-19 16:48  源码\java\createproject\zhuoxin\
     目录           0  2016-05-19 16:48  源码\java\createproject\zhuoxin\edu\
     目录           0  2016-05-19 16:48  源码\java\createproject\zhuoxin\edu\housekeeperdemo1\
     目录           0  2016-05-19 16:48  源码\java\createproject\zhuoxin\edu\housekeeperdemo1\activity\
     文件        1993  2016-05-19 16:09  源码\java\createproject\zhuoxin\edu\housekeeperdemo1\activity\MainActivity.java
     目录           0  2016-05-19 16:48  源码\java\createproject\zhuoxin\edu\housekeeperdemo1\adapter\
     文件        2843  2016-05-19 16:09  源码\java\createproject\zhuoxin\edu\housekeeperdemo1\adapter\ListviewAdapter.java
     目录           0  2016-05-19 16:48  源码\java\createproject\zhuoxin\edu\housekeeperdemo1\entity\
     文件         504  2016-05-19 16:09  源码\java\createproject\zhuoxin\edu\housekeeperdemo1\entity\MsgInfo.java
     目录           0  2016-05-19 16:48  源码\res\
     目录           0  2016-05-19 16:48  源码\res\drawable\
     文件       28124  2016-05-19 13:31  源码\res\drawable\boy.png
     文件         282  2016-05-18 14:03  源码\res\drawable\btn_float.xml
     文件         199  2016-05-18 14:01  源码\res\drawable\btn_float_normal.xml
     文件         197  2016-05-19 12:16  源码\res\drawable\btn_float_pressed.xml
     文件       16074  2016-05-19 13:32  源码\res\drawable\girl.png
     文件        8875  2016-05-19 13:23  源码\res\drawable\left.9.png
     文件        8828  2016-05-19 13:18  源码\res\drawable\right.9.png
     目录           0  2016-05-19 16:48  源码\res\layout\
     文件        1779  2016-05-19 16:09  源码\res\layout\activity_main.xml
     文件        2653  2016-05-19 16:09  源码\res\layout\item.xml
     目录           0  2016-05-19 16:48  源码\res\mipmap-hdpi\
     文件        3418  2016-05-19 12:45  源码\res\mipmap-hdpi\ic_launcher.png
     目录           0  2016-05-19 16:48  源码\res\mipmap-mdpi\
     文件        2206  2016-05-19 12:45  源码\res\mipmap-mdpi\ic_launcher.png
     目录           0  2016-05-19 16:48  源码\res\mipmap-xhdpi\
............此处省略12个文件信息

评论

共有 条评论