</pre><pre name="code" class="java">public class TalkAct extends AppCompatActivity {
private List<Msg> msgList = new ArrayList<Msg>();
/**
* ATTENTION: This was auto-generated to implement the App Indexing API.
* See https://g.co/AppIndexing/AndroidStudio for more information.
*/
private GoogleApiClient client;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_talk);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
init();
MsgAdapter msgAdapter = new MsgAdapter(TalkAct.this, R.layout.msgtextviewlayout, msgList);
ListView listView=(ListView)findViewById(R.id.tv_msg);
listView.setAdapter(msgAdapter);
// ATTENTION: This was auto-generated to implement the App Indexing API.
// See https://g.co/AppIndexing/AndroidStudio for more information.
client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
}
public void init() {
Msg msg = new Msg("how do you do", Msg.SEND);
msgList.add(msg);
Msg rev1 = new Msg("how do you do,too", Msg.RECIEVE);
msgList.add(rev1);
msgList.add(msg);
msgList.add(rev1);
}
第一行代码里的,照着写一遍,不知道怎么搞得,viewHolder.rightText.setText(msg.getContent());这一行总是吧不起效果!!更奇怪的是,有时候有,有时候没有!找了两三个小时没找到!先不管了吃饭去!3月12日!public class MsgAdapter extends ArrayAdapter { private int resour