View destItemView = mAdapter.getView(positionInt,null,mListView);if(null != destItemView){ TextView tvContent = (TextView) destItemView.findViewById(R.id.tv_chatcontent); RelativeLayoutrlFailHint = (RelativeLayout) destItemView.findViewById(R.id.send_mesg_fail_rl_id); ImageView ivFailHint = (ImageView) destItemView.findViewById(R.id.send_message_fail_iv_id); if(null != tvContent && (null != rlFailHint)){ String msgCont = tvContent.getText().toString(); if(content.equals(msgCont)){ rlFailHint.setVisibility(View.VISIBLE); ivFailHint.setVisibility(View.VISIBLE); Toast.makeText(ChatRoomActivity.this,"已经设置显示了",Toast.LENGTH_SHORT).show(); } final String p = positionStr; final String name = "pengming"; final String msg = msgCont; rlFailHint.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { if(NetUtil.isNetworkAvailable(ChatRoomActivity.this)){ new SendMessageAsyncTask().execute(name,msg,p); }else{ //网络不可用,不发送 Toast.makeText(ChatRoomActivity.this,getString(R.string.please_check_network_if_ok),Toast.LENGTH_SHORT).show(); } } }); }}下面这个是adapter的每个item对应的xml<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" android:orientation="vertical" android:padding="6dp" > <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:orientation="vertical" > <TextView android:id="@+id/tv_sendtime" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#bfbfbf" android:padding="2dp" android:textColor="#ffffff" android:textSize="12sp" /> </LinearLayout> <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="5dp" > <ImageView android:id="@+id/iv_userhead" android:layout_width="@dimen/chatmemmber_headpic_height" android:layout_height="@dimen/chatmemmber_headpic_height" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:focusable="false" /> <TextView android:id="@+id/tv_username" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toLeftOf="@id/iv_userhead" android:layout_marginRight="10dp" android:textColor="#818181" android:focusable="false" android:textSize="15sp" /> <TextView android:id="@+id/tv_chatcontent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="10dp" android:layout_toLeftOf="@id/iv_userhead" android:layout_below="@+id/tv_username" android:background="@drawable/chatto_bg" android:clickable="true" android:focusable="true" android:gravity="left|center" android:lineSpacingExtra="2dp" android:minHeight="30dp" android:textColor="#ff000000" android:textSize="15sp" /> <RelativeLayout android:id="@+id/send_mesg_fail_rl_id" android:layout_width="@dimen/send_fail_hint_width" android:layout_height="@dimen/send_fail_hint_width" android:layout_toLeftOf="@+id/tv_chatcontent" android:background="@drawable/send_fail_bg" android:layout_centerVertical="true"> <ImageView android:id="@+id/send_message_fail_iv_id" android:layout_width="@dimen/logoHeight" android:layout_height="@dimen/logoHeight" android:src="@drawable/ic_warning_black_24dp" android:layout_centerHorizontal="true"/> <TextView android:id="@+id/send_mesg_fail_tv_id" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/send_fail_text" android:layout_centerHorizontal="true" android:textColor="@color/buttonExitClikedColor" android:layout_below="@+id/send_message_fail_iv_id"/> </RelativeLayout> </RelativeLayout></LinearLayout>
目前暂无任何回答
- 0 回答
- 0 关注
- 1928 浏览
添加回答
举报
0/150
提交
取消