Expandable list child selection problem in Android?

Ok. Found a solution Disabled isChildSelectable: public boolean isChildSelectable(int groupPosition, int childPosition) { return false; } Implemented my onTouchListener in getChildView: public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { parent. SetDescendantFocusability(ViewGroup.

FOCUS_BLOCK_DESCENDANTS); View childView = getMyView(); childView. SetOnTouchListener(new OnTouchListener(){ @Override public boolean onTouch(View view, MotionEvent event) { if (event.getAction() == MotionEvent. ACTION_DOWN) { view.

SetBackgroundColor(Color. BLUE); return true; } if (event.getAction() == MotionEvent. ACTION_UP) { view.

SetBackgroundColor(Color. WHITE); return true; } if (event.getAction() == MotionEvent. ACTION_OUTSIDE) { view.

SetBackgroundColor(Color. WHITE); return true; } if (event.getAction() == MotionEvent. ACTION_CANCEL) { view.

SetBackgroundColor(Color. WHITE); return true; } return false; } }); LinearLayout newView = new LinearLayout(context); newView. SetPadding(15, 0, 15, 0); newView.

AddView(childView); return newView; }.

Ok. Found a solution. Disabled isChildSelectable: public boolean isChildSelectable(int groupPosition, int childPosition) { return false; } Implemented my onTouchListener in getChildView: public View getChildView(final int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { parent.

SetDescendantFocusability(ViewGroup. FOCUS_BLOCK_DESCENDANTS); View childView = getMyView(); childView. SetOnTouchListener(new OnTouchListener(){ @Override public boolean onTouch(View view, MotionEvent event) { if (event.getAction() == MotionEvent.

ACTION_DOWN) { view. SetBackgroundColor(Color. BLUE); return true; } if (event.getAction() == MotionEvent.

ACTION_UP) { view. SetBackgroundColor(Color. WHITE); return true; } if (event.getAction() == MotionEvent.

ACTION_OUTSIDE) { view. SetBackgroundColor(Color. WHITE); return true; } if (event.getAction() == MotionEvent.

ACTION_CANCEL) { view. SetBackgroundColor(Color. WHITE); return true; } return false; } }); LinearLayout newView = new LinearLayout(context); newView.

SetPadding(15, 0, 15, 0); newView. AddView(childView); return newView; }.

I am building an application that will use an expandable list view to display a list of preferences. I have built the group and child lists with no problem using separate xml layouts for the group rows and child rows (as found in most examples here and Android docs). My child layout includes two buttons which would be used to indicate if a user wants to include or exclude that item in their preferences.

A) change the appearance of each button when clicked, and b) use the click action or state later on to store a boolean type response indicating whether the user wants/dont wants that preference? I have found samples where you can build an action based on the user clicking the child itself, but I need to actually build the action based on the user clicking on one of the buttons in the child. Unfortunately, this forum does not allow me to post an image to show what I am talking about, so hopefully my question is clear.

Any thoughts on how I might go about getting button functionality?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions