listview的itemonclick在某种情况下点击无效

今天在做项目的时候遇到了这样的问题,先上界面图



在点击编辑按钮的时候会对列表进行状态改变

下面看一下代码

package com.hipad.classroom.activity;

import java.util.ArrayList;
import java.util.ListIterator;

import org.json.JSONObject;

import com.google.gson.Gson;
import com.hipad.classroom.adapter.StudyAdapter;
import com.hipad.classroom.adapter.StudyAdapter.AdapterClickListener;
import com.hipad.classroom.bean.StudyHistoryDatas;
import com.hipad.classroom.bean.StudyHistoryDatas.StudyList;
import com.hipad.classroom.http.HttpInstance;
import com.hipad.classroom.main.R;
import com.hipad.classroom.pulltorefresh.PullToRefreshLayout;
import com.hipad.classroom.pulltorefresh.PullToRefreshLayout.OnRefreshListener;
import com.hipad.classroom.pulltorefresh.PullableListView;
import com.hipad.classroom.tools.Constants;
import com.hipad.classroom.usercenter.tools.CommonUtils;
import com.hipad.utils.SpUtils;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.provider.Settings.SettingNotFoundException;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

public class PlayHistoryActivity extends FragmentActivity implements OnClickListener {
	// 编辑按钮显示文字内容的标志
	private boolean clickFlag = false;

	private Button btnItemEdit;
	private StudyAdapter studyAdapter;
	private HttpInstance httpInstance;
	private String token = "";
	private ArrayList<StudyList> studyList = new ArrayList<StudyHistoryDatas.StudyList>();
	private ImageView img_loading, img_back;
	private AnimationDrawable animationDrawable;
	private int index;
	private PullableListView pullList;
	private PullToRefreshLayout refresh_view;
	private TextView txt_loading, txt_title;
	private LinearLayout linear_cue;

	private Button check_all;

	private Button delect_all;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_study_vedio);
		httpInstance = new HttpInstance();

		initViews();
		setListener();
	}

	private void setListener() {
		// TODO
		btnItemEdit.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				if (!CommonUtils.isLogin(v.getContext())) {
					Toast.makeText(v.getContext(), getResources().getString(R.string.edit_no_content),
							Toast.LENGTH_SHORT).show();
					return;
				}
				if (studyAdapter.getList().size() == 0) {
					Toast.makeText(v.getContext(), getResources().getString(R.string.edit_no_content),
							Toast.LENGTH_SHORT).show();
					return;
				}

				editButtonProformClick();
			}

		});
	}

	// 控件初始化
	private void initViews() {
		btnItemEdit = (Button) findViewById(R.id.btn_edit_study);

		check_all = (Button) findViewById(R.id.study_check_all_btn);
		delect_all = (Button) findViewById(R.id.study_delete_all_btn);
		check_all.setOnClickListener(this);
		delect_all.setOnClickListener(this);
		linear_cue = (LinearLayout) findViewById(R.id.linear_cue_study);
		check_delete_ll = (LinearLayout) findViewById(R.id.ll_download_bottom_button);
		// tvStudyDate0 = (TextView) findViewById(R.id.tv_study_date0);
		// tvStudyDate1 = (TextView) findViewById(R.id.tv_study_date1);
		pullList = (PullableListView) findViewById(R.id.pullList_studyVideo);
		refresh_view = (PullToRefreshLayout) findViewById(R.id.refresh_studyVideo);
		img_loading = (ImageView) findViewById(R.id.img_loading_study);

		txt_loading = (TextView) findViewById(R.id.txt_loading_study);
		txt_loading.setOnClickListener(this);
		img_back = (ImageView) findViewById(R.id.img_back_study);
		txt_title = (TextView) findViewById(R.id.txt_title_study);
		// lvStudyRecordDate0.setItemsCanFocus(true);

		img_back.setVisibility(View.VISIBLE);
		//
		txt_title.setText("播放历史");

		initData();

		viewOnClick();
	}

	private void initData() {
		token = (String) SpUtils.get(this, "classroom_token", "");
		if (token.equals("") && token.isEmpty()) {
			linear_cue.setVisibility(View.VISIBLE);
			refresh_view.setVisibility(View.GONE);
			img_loading.setVisibility(View.VISIBLE);
			img_loading.setBackgroundResource(R.drawable.record_none);
			// txt_loading.setVisibility(View.GONE);
			txt_loading.setText(getResources().getString(R.string.cue_noLogin));
			txt_loading.setText(getResources().getString(R.string.cue_noLogin));
		} else {
			img_loading.setBackgroundResource(R.anim.loading_videoplay);
			animationDrawable = (AnimationDrawable) img_loading.getBackground();
			animationDrawable.start();
			txt_loading.setText(getResources().getString(R.string.loading));
			txt_loading.setVisibility(View.VISIBLE);
			doHttpGetInfo(0);
		}
	}

	public void viewOnClick() {
		pullList.setOnItemClickListener(new OnItemClickListener() {
			@Override
			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
				
				if (btnItemEdit.getText().toString().equals("编辑")) {
					Log.d("zhsy", "xiaobei============"+"2222222222222222");
					Intent intent = new Intent(getApplication(), VideoPlayActivity.class);
					intent.putExtra("id", studyList.get(position).id);
					intent.putExtra("cid", studyList.get(position).cid);
					intent.putExtra("type", "1");
					startActivity(intent);
				} else if (btnItemEdit.getText().toString().equals("完成")) {
					Log.d("zhsy", "xiaobei============"+"1111111111");
					CheckBox checkBox = (CheckBox) view.findViewById(R.id.study_video_check_cb);
					if (studyList.get(position).isCheck) {
						checkBox.setChecked(false);
						studyList.get(position).isCheck = false;
					} else {
						checkBox.setChecked(true);
						studyList.get(position).isCheck = true;
					}
				}
				
			}
		});
		img_back.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				finish();
			}
		});
		refresh_view.setOnRefreshListener(new OnRefreshListener() {

			@Override
			public void onRefresh(PullToRefreshLayout pullToRefreshLayout) {
				new Handler() {
					@Override
					public void handleMessage(Message msg) {
						doHttpGetInfo(1);

					}
				}.sendEmptyMessageDelayed(0, 1000);
			}

			@Override
			public void onLoadMore(PullToRefreshLayout pullToRefreshLayout) {
				new Handler() {
					@Override
					public void handleMessage(Message msg) {
						refresh_view.loadmoreFinish(PullToRefreshLayout.SUCCEED);
					}
				}.sendEmptyMessageDelayed(0, 1000);
			}
		});
	}

	Handler handler = new Handler() {
		public void handleMessage(android.os.Message msg) {
			switch (msg.what) {
			case Constants.SEND_SUCCESS:
				if (studyList != null) {
					animationDrawable.stop();
					img_loading.setVisibility(View.GONE);
					txt_loading.setVisibility(View.GONE);
					if (studyList.size() == 0) {
						linear_cue.setVisibility(View.VISIBLE);
						refresh_view.setVisibility(View.GONE);
						img_loading.setVisibility(View.VISIBLE);
						txt_loading.setVisibility(View.VISIBLE);
						img_loading.setBackgroundResource(R.drawable.record_none);
						txt_loading.setText(getResources().getString(R.string.cue_noStudy));
					} else {
						linear_cue.setVisibility(View.GONE);
						refresh_view.setVisibility(View.VISIBLE);
						pullList.setVisibility(View.VISIBLE);
						studyAdapter = new StudyAdapter(getApplicationContext(), pullList, studyList);
						studyAdapter.setAdapterClickListener(new AdapterClickListener() {
							@Override
							public void onAdapterClickListener(View v, StudyList detail, int position) {
								doHttpDelHistory(position);
							}
						});
						pullList.setAdapter(studyAdapter);
						btnItemEdit.setVisibility(View.VISIBLE);
					}
				}
				break;

			case Constants.SEND_FAILD:
				animationDrawable.stop();
				linear_cue.setVisibility(View.VISIBLE);
				refresh_view.setVisibility(View.GONE);
				img_loading.setVisibility(View.VISIBLE);
				txt_loading.setVisibility(View.VISIBLE);
				img_loading.setBackgroundResource(R.drawable.record_none);
				txt_loading.setText(getResources().getString(R.string.cue_noNetwork));
				break;
			case Constants.SEND_NET_ERROR:
				animationDrawable.stop();
				linear_cue.setVisibility(View.VISIBLE);
				refresh_view.setVisibility(View.GONE);
				img_loading.setVisibility(View.VISIBLE);
				txt_loading.setVisibility(View.VISIBLE);

				img_loading.setBackgroundResource(R.drawable.background_comment_gray_circle);
				txt_loading.setText(getResources().getString(R.string.cue_noNetwork));
				break;
			case 11:
				studyList.remove(index);
				Toast.makeText(getApplication(), "删除学习记录成功", Toast.LENGTH_LONG).show();
				noDataView();
				break;
			case 111:
				// TODO
				Toast.makeText(getApplication(), "删除学习记录成功", Toast.LENGTH_LONG).show();
				ArrayList<StudyList> list = studyAdapter.getList();
				ListIterator<StudyList> listIterator = list.listIterator();
				while (listIterator.hasNext()) {
					StudyList next = listIterator.next();
					int indexOf = list.indexOf(next);
					if (next.isCheck) {
						listIterator.remove();
					}
				}

				noDataView();

				break;
			case 257:
				refresh_view.refreshFinish(PullToRefreshLayout.SUCCEED);
				studyAdapter = new StudyAdapter(getApplicationContext(), pullList, studyList);
				studyAdapter.setAdapterClickListener(new AdapterClickListener() {
					@Override
					public void onAdapterClickListener(View v, StudyList detail, int position) {
						doHttpDelHistory(position);
					}
				});
				pullList.setAdapter(studyAdapter);
				btnItemEdit.setText("编辑");
				break;

			default:
				break;
			}
		}

		private void noDataView() {
			if (studyAdapter.getList().size() == 0) {
				if (!btnItemEdit.getText().toString().equals("编辑")) {
					editButtonProformClick();
				}
				linear_cue.setVisibility(View.VISIBLE);
				refresh_view.setVisibility(View.GONE);
				img_loading.setVisibility(View.VISIBLE);
				txt_loading.setVisibility(View.VISIBLE);
				txt_loading.setText(getResources().getString(R.string.cue_noStudy));
				img_loading.setBackgroundResource(R.drawable.record_none);

			}
			studyAdapter.notifyDataSetChanged();
		};
	};

	private LinearLayout check_delete_ll;

	private boolean isAllCheck;

	public void doHttpDelHistory(final int position) {
		new Thread(new Runnable() {
			@Override
			public void run() {

				try {
					String json = httpInstance.getInstance().doHttpPost(httpInstance.getDelStudyHistoryUrl(),
							"token=" + token + "&recordid=" + studyList.get(position).recordid);
					JSONObject object = new JSONObject(json);
					Log.i("zst", "study----json=====" + json);
					if (object.getInt("rt") == 0) {
						index = position;
						handler.obtainMessage(11).sendToTarget();

					}
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}).start();
	}

	public void doHttpGetInfo(final int arg) {
		new Thread(new Runnable() {
			@Override
			public void run() {
				try {
					String jsonInfo = httpInstance.getInstance().doHttpGet(httpInstance.getStudyHistoryUrl(token, 1));
					Gson gson = new Gson();
					StudyHistoryDatas historyDatas = gson.fromJson(jsonInfo, StudyHistoryDatas.class);
					if (historyDatas.rt == 0) {
						studyList = historyDatas.data;
						if (arg == 0) {
							handler.obtainMessage(Constants.SEND_SUCCESS).sendToTarget();
						} else {
							handler.obtainMessage(257).sendToTarget();
						}

					} else {
						handler.obtainMessage(Constants.SEND_FAILD).sendToTarget();
					}
				} catch (Exception e) {
					e.printStackTrace();
					handler.obtainMessage(Constants.SEND_NET_ERROR).sendToTarget();
					Log.i("zst", "study------e====" + e);
				}
			}
		}).start();

	}

	/**
	 * 重新计算ListView的高度, 解决ScrollView和ListView两个View都有滚动的效果,在嵌套使用时起冲突的问题
	 * 
	 * @param listView
	 */

	public void setListViewHeight(ListView listView) {
		// 获取ListView对应的Adapter
		ListAdapter listAdapter = listView.getAdapter();
		if (listAdapter == null) {
			return;
		}
		int totalHeight = 0;
		for (int i = 0, len = listAdapter.getCount(); i < len; i++) { // listAdapter.getCount()返回数据项的数目
			View listItem = listAdapter.getView(i, null, listView);
			listItem.measure(0, 0); // 计算子项View 的宽高
			totalHeight += listItem.getMeasuredHeight(); // 统计所有子项的总高度
		}
		ViewGroup.LayoutParams params = listView.getLayoutParams();
		params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1));
		listView.setLayoutParams(params);
	}

	@Override
	public void onClick(View v) {

		switch (v.getId()) {
		case R.id.study_check_all_btn:
			isAllCheck = !isAllCheck;

			if (studyAdapter != null) {
				studyAdapter.setCheck(isAllCheck);
			}
			break;
		case R.id.txt_loading_study:
			initData();
			break;

		case R.id.study_delete_all_btn:
			// TODO 多条删除的点击事件
			StringBuilder builder = new StringBuilder();
			if (studyAdapter != null) {
				ArrayList<StudyList> list = studyAdapter.getList();
				ListIterator<StudyList> listIterator = list.listIterator();
				while (listIterator.hasNext()) {
					StudyList next = listIterator.next();
					int indexOf = list.indexOf(next);
					if (next.isCheck) {
						if (builder.length() == 0) {
							builder.append(next.recordid);
						} else {

							builder.append("," + next.recordid);
						}

					}
				}
				// TODO 多条删除接口
				deleteCheck(builder);
			}
			break;
		}
	}

	private void deleteCheck(final StringBuilder builder) {
		new Thread(new Runnable() {
			@Override
			public void run() {
				try {
					String json = httpInstance.getInstance().doHttpPost(httpInstance.getDelStudyHistoryUrl(),
							"token=" + token + "&recordid=" + builder);

					JSONObject object = new JSONObject(json);
					Log.i("zst", "study----json=====" + object.getBoolean("data"));
					if (object.getBoolean("data")) {

						handler.obtainMessage(111).sendToTarget();
					}
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}).start();
	}

	private void editButtonProformClick() {
		if (studyAdapter != null) {
			if (studyAdapter.getShow()) {
				studyAdapter.setShow(!studyAdapter.getShow());
				btnItemEdit.setText("编辑");
				check_delete_ll.setVisibility(View.GONE);
				
			} else {
				studyAdapter.setShow(!studyAdapter.getShow());
				btnItemEdit.setText("完成");
				check_delete_ll.setVisibility(View.VISIBLE);
			}
		}
	}
}

Adapter代码

package com.hipad.classroom.adapter;

import java.util.ArrayList;

import com.hipad.classroom.bean.StudyHistoryDatas;
import com.hipad.classroom.bean.StudyHistoryDatas.StudyList;
import com.hipad.classroom.main.R;
import com.hipad.classroom.tools.DateTools;
import com.hipad.classroom.tools.Options;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

public class StudyAdapter extends BaseAdapter {
	private LayoutInflater inflate;
	// private ICartPresenter cartPresenter;
	// 作为删除图标是否显示的标志 TODO 了解逻辑
	private ImageLoader imageLoader = ImageLoader.getInstance();
	private DisplayImageOptions options;
	private ArrayList<StudyList> studyLists;
	private AdapterClickListener adapterClickListener;
	private DeleteAllClickListener mDeleteAllClickListener;

	private boolean isShow = false;
	public void setShow(boolean isShow) {
		this.isShow = isShow;
		notifyDataSetChanged();
	}

	public boolean getShow() {
		return isShow;
	}

	public StudyAdapter(Context context, ListView listview, ArrayList<StudyList> studyList) {
		// this.context = context;
		this.studyLists = studyList;
		options = Options.getListOptions();
		inflate = LayoutInflater.from(context);
	}

	@Override
	public int getCount() {
		return studyLists == null ? 0 : studyLists.size();
	}

	@Override
	public Object getItem(int position) {
		return studyLists.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(final int position, View view, ViewGroup parent) {
		ViewHolder holder = null;
		if (view == null) {
			view = inflate.inflate(R.layout.list_item_study_record, null);
			holder = new ViewHolder();
			holder.tvName = (TextView) view.findViewById(R.id.tv_list_item_study_week_title);
			holder.imgIcon = (ImageView) view.findViewById(R.id.img_subscribe_recommend_vedioIcon);
			holder.txt_progress = (TextView) view.findViewById(R.id.tv_list_item_study_week_completion);
			// 需要在Listview的item条目里响应点击的控件
			holder.ivDel = (ImageView) view.findViewById(R.id.iv_list_study_week_delete);
			holder.checkBox = (CheckBox) view.findViewById(R.id.study_video_check_cb);
			
			holder.checkBox.setVisibility(View.GONE);
			view.setTag(holder);
		}
		holder = (ViewHolder) view.getTag();

		final StudyHistoryDatas.StudyList item = studyLists.get(position);

		holder.ivDel.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				if (adapterClickListener != null) {
					adapterClickListener.onAdapterClickListener(v, item, position);
				}

			}
		});
		holder.checkBox.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
			if(mDeleteAllClickListener!=null){
				mDeleteAllClickListener.onCheckClickListener(v,item,position);
			}
			}
		});
		final ImageView ivDel = holder.ivDel;
		final CheckBox checkImageView = holder.checkBox;
		if (isShow) {
			//ObjectAnimator anim = ObjectAnimator.ofFloat(ivDel, "adf", 0f, 1f);
			//ObjectAnimator anim2 = ObjectAnimator.ofFloat(ivDel, "adf", 0f, 1f);

			/*
			 * ObjectAnimator objectAnimator =
			 * ObjectAnimator.ofFloat(holder.checkImageView, "translationX",
			 * -1.0f, 0f, 1.0f, 0f); objectAnimator.setInterpolator(new
			 * CycleInterpolator(5));
			 * holder.checkImageView.setVisibility(View.VISIBLE);
			 * objectAnimator.setDuration(1000); objectAnimator.start();
			 */
			/*
			 * TranslateAnimation translateAnimation = new
			 * TranslateAnimation(Animation.RELATIVE_TO_PARENT, -1.0f,
			 * Animation.RELATIVE_TO_PARENT, 1f, Animation.RELATIVE_TO_PARENT,
			 * 0f, Animation.RELATIVE_TO_PARENT, 0f);
			 * translateAnimation.setDuration(5000);
			 * checkImageView.setAnimation(translateAnimation);
			 * translateAnimation.start();
			 */

			/*anim2.addUpdateListener(new AnimatorUpdateListener() {

				@Override
				public void onAnimationUpdate(ValueAnimator animation) {
					float value = (Float) animation.getAnimatedValue();
					checkImageView.setAlpha(value);
				}
			});
			anim2.setDuration(1000);
			anim2.start();
*/
			holder.checkBox.setVisibility(View.VISIBLE);
			/*anim.addUpdateListener(new AnimatorUpdateListener() {

				@Override
				public void onAnimationUpdate(ValueAnimator animation) {
					float value = (Float) animation.getAnimatedValue();
					ivDel.setScaleX(value);
					ivDel.setScaleY(value);
				}
			});
			anim.setDuration(1000);
			anim.start();*/
		} else {
		/*	ObjectAnimator anim = ObjectAnimator.ofFloat(ivDel, "adf", 1f, 0f);
			anim.addUpdateListener(new AnimatorUpdateListener() {

				@Override
				public void onAnimationUpdate(ValueAnimator animation) {
					float value = (Float) animation.getAnimatedValue();
					ivDel.setScaleX(value);
					ivDel.setScaleY(value);
				}
			});
			anim.setDuration(1000);
			anim.start();*/
			holder.checkBox.setVisibility(View.GONE);
			
		}

		// 为holder里的控件赋值
		String time = DateTools.getStrTime_ms(item.time);
		holder.tvName.setText(item.title);
		holder.txt_progress.setText("已学习:" + time);
		holder.checkBox.setChecked(item.isCheck);
		DisplayImageOptions options = new DisplayImageOptions.Builder()
				// 缓存到内存
				.cacheInMemory(true)
				// 设置图片在下载期间显示的图片
				.showImageOnLoading(R.drawable.background_comment_03)
				// 设置图片Uri为空或是错误的时候显示的图片
				.showImageForEmptyUri(R.drawable.background_comment_03)
				// 设置图片加载/解码过程中错误时候显示的图片
				.showImageOnFail(R.drawable.background_comment_03).build();
		imageLoader.displayImage(item.thumb, holder.imgIcon, options);

		return view;
	}

	public void setAdapterClickListener(AdapterClickListener adapterClickListener) {
		this.adapterClickListener = adapterClickListener;
	}
	public void setDeleteAllClickListener(DeleteAllClickListener deleteAllClickListener) {
		this.mDeleteAllClickListener = deleteAllClickListener;
	}

	public interface AdapterClickListener {
		void onAdapterClickListener(View v, StudyList detail, int position);
	}
	public interface DeleteAllClickListener {
		void onCheckClickListener(View v, StudyList detail, int position);
	}
	class ViewHolder {
		public CheckBox checkBox;
		TextView tvName;
		ImageView ivDel;
		private ImageView imgIcon;
		private TextView txt_progress;
	}
	public void setCheck(boolean isAllCheck) {
		for(StudyList studyList:studyLists ){
			studyList.setCheck(isAllCheck);
		}
		notifyDataSetChanged();
	}

	public ArrayList<StudyList> getList() {
		return studyLists;
		
	}

}

开始以为是这里面的焦点冲突,导致当“编辑”变为“完成”的时候就不走listview的onitem点击事件了,也就是这块的方法


pullList.setOnItemClickListener(new OnItemClickListener() {
			@Override
			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
				
				if (btnItemEdit.getText().toString().equals("编辑")) {
					Log.d("zhsy", "xiaobei============"+"2222222222222222");
					Intent intent = new Intent(getApplication(), VideoPlayActivity.class);
					intent.putExtra("id", studyList.get(position).id);
					intent.putExtra("cid", studyList.get(position).cid);
					intent.putExtra("type", "1");
					startActivity(intent);
				} else if (btnItemEdit.getText().toString().equals("完成")) {
					Log.d("zhsy", "xiaobei============"+"1111111111");
					CheckBox checkBox = (CheckBox) view.findViewById(R.id.study_video_check_cb);
					if (studyList.get(position).isCheck) {
						checkBox.setChecked(false);
						studyList.get(position).isCheck = false;
					} else {
						checkBox.setChecked(true);
						studyList.get(position).isCheck = true;
					}
				}
				
			}
		});



但是整条的item点击事件无效时,其中item中的删除按钮点击事件还存在,后来在网上找的帖子,有一个最简单的解决方案,也就是在item的xml根目录下加上这句话

android:descendantFocusability="blocksDescendants"


如下代码

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:padding="@dimen/pad_height_14"
     android:descendantFocusability="blocksDescendants">
     
    <CheckBox 
        android:id="@+id/study_video_check_cb"
         android:layout_height="@dimen/pad_height_15"
       android:layout_width="@dimen/pad_height_15"
       android:layout_centerVertical="true"
       android:background="@drawable/download_selete__delete_sign"
       android:layout_gravity="center_vertical"
        android:checked="false"
            android:button="@null" 
       android:visibility="gone"
         />
  
<RelativeLayout
     android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:paddingLeft="@dimen/pad_height_8">
    <ImageView
        android:id="@+id/img_subscribe_recommend_vedioIcon"
        android:layout_width="@dimen/pad_height_108"
        android:layout_height="@dimen/pad_height_71"
        android:layout_marginRight="@dimen/pad_height_5"
        android:layout_toRightOf="@+id/ivDel"
        android:background="@drawable/background_comment_03" />

    <TextView
        android:id="@+id/tv_list_item_study_week_title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginRight="@dimen/pad_height_8"
        android:layout_toRightOf="@+id/img_subscribe_recommend_vedioIcon"
        android:singleLine="true"
        android:text="title"
        android:textColor="@color/simple_333333"
        android:textSize="@dimen/pad_text_size_14" />

    <TextView
        android:id="@+id/tv_list_item_study_week_completion"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/img_subscribe_recommend_vedioIcon"
        android:layout_toRightOf="@+id/img_subscribe_recommend_vedioIcon"
        android:text="已学至5%"
        android:textColor="@color/dimgray"
        android:textSize="@dimen/pad_text_size_12" />

    <ImageView
        android:id="@+id/iv_list_study_week_delete"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/img_subscribe_recommend_vedioIcon"
        android:layout_alignParentRight="true"
        android:src="@drawable/activity_study_recode_delete" 
        />

</RelativeLayout>
</LinearLayout>




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值