- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个使用自定义适配器的可扩展 ListView 的项目。
我的 ListView 可以正常工作,但是
当这两个问题开始时,问题就出现了:
1-错误的 child 点击开始。我点击的 child 不会工作,但另一个
2-点击后应用程序崩溃。
这是我的适配器:
@SuppressWarnings("unchecked")
public ArrayList<String> groupItem, tempChild;
public ArrayList<Object> Childtem = new ArrayList<Object>();
public LayoutInflater minflater;
public Activity activity;
public NewAdapter(ArrayList<String> grList, ArrayList<Object> childItem) {
groupItem = grList;
this.Childtem = childItem;
}
public void setInflater(LayoutInflater mInflater, Activity act) {
this.minflater = mInflater;
activity = act;
}
public Object getChild(int groupPosition, int childPosition) {
return null;
}
public long getChildId(int groupPosition, int childPosition) {
return 0;
}
public View getChildView(int groupPosition, final int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
tempChild = (ArrayList<String>) Childtem.get(groupPosition);
TextView text = null;
if (convertView == null) {
convertView = minflater.inflate(R.layout.childrow, null);
}
text = (TextView) convertView.findViewById(R.id.textView1);
text.setText(tempChild.get(childPosition));
//typeface
text.setTypeface(G.typeFacePrs);
//************
convertView.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Log.i("LOG", "childposition"+tempChild.get(childPosition));
//customized toast by Mahdi Tajik
Toast toast = Toast.makeText(activity, tempChild.get(childPosition),Toast.LENGTH_LONG);
Log.i("LOG", "tempChild.get(childPosition)"+tempChild.get(childPosition));
View view = toast.getView();
view.setBackgroundColor(Color.parseColor("#e60017"));
toast.setGravity(Gravity.BOTTOM, 0, 78);
TextView text = (TextView) view.findViewById(android.R.id.message);
//text.setText("balabalalalalalal");
//here you can do anything with text
//toast.setView(text);
toast.show();
loadContent(tempChild.get(childPosition));
/*custom toast by: mahdi tajik
*
Toast toast = new Toast(context);
toast.setDuration(Toast.LENGTH_LONG);
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.custom_layout, null);
toast.setView(view);
toast.show();
*
*/
}
private void loadContent(String key) {
Class distination_act = ContentActivity.class;
Activity myAct = G.currentActivity;
String mDrawableName = "";
if(key=="تغییر در عادات روده ای و مثانه"){
G.must_load_content = G.currentActivity.getString(R.string.content_text_1001);
mDrawableName = "text_1001";
}
if(key=="پشت درد مداوم، تغییر رنگ ادرار و مدفوع"){
G.must_load_content = G.currentActivity.getString(R.string.content_text_1002);
mDrawableName = "text_1002";
}
if(key=="افسردگی"){
G.must_load_content = G.currentActivity.getString(R.string.content_text_1003);
mDrawableName = "text_1003";
}
if(key=="عفونت کلامیدیائی"){
G.must_load_content = G.currentActivity.getString(R.string.content_text_2001);
mDrawableName = "text_2001";
}
if(key=="سوزاک"){
G.must_load_content = G.currentActivity.getString(R.string.content_text_2002);
mDrawableName = "text_2002";
}
if(key=="سیفیلیس"){
G.must_load_content = G.currentActivity.getString(R.string.content_text_2003);
mDrawableName = "text_2003";
}
if(key=="تبخال تناسلی"){
G.must_load_content = G.currentActivity.getString(R.string.content_text_2004);
mDrawableName = "text_2004";
}
if(key=="زگیل تناسلی"){
G.must_load_content = G.currentActivity.getString(R.string.content_text_2005);
mDrawableName = "text_2005";
}
if(key=="ایدز"){
G.must_load_content = G.currentActivity.getString(R.string.content_text_2006);
mDrawableName = "text_2006";
}
if(key=="التهاب پروستات"){
G.must_load_content = G.currentActivity.getString(R.string.content_text_3001);
mDrawableName = "text_3001";
}
if(key=="بزرگی خوش خیم پروستات"){
G.must_load_content = G.currentActivity.getString(R.string.content_text_3002);
mDrawableName = "text_3002";
}
if(key=="سرطان پروستات"){
G.must_load_content = G.currentActivity.getString(R.string.content_text_3003);
mDrawableName = "text_3003";
}
if(key=="افزایش فشار خون"){
G.must_load_content = G.currentActivity.getString(R.string.content_text_4001);
mDrawableName = "text_4001";
}
if(key=="بیماری عروق کرونری قلب"){
G.must_load_content = G.currentActivity.getString(R.string.content_text_4002);
mDrawableName = "text_4002";
}
if(key=="سکته قلبی"){
G.must_load_content = G.currentActivity.getString(R.string.content_text_4003);
mDrawableName = "text_4003";
}
if(key=="دیابت"){
G.must_load_content = G.currentActivity.getString(R.string.content_text_5001);
mDrawableName = "text_5001";
}
if(key=="سرطان بیضه"){
G.must_load_content = G.currentActivity.getString(R.string.content_text_6001);
mDrawableName = "text_6001";
}
if(key=="زندگی سالم"){
G.must_load_content = G.currentActivity.getString(R.string.content_text_7001);
mDrawableName = "text_7001";
}
if(key=="یک رژیم غذائی سالم به چه چیزی شبیه است؟"){
G.must_load_content = G.currentActivity.getString(R.string.content_text_8001);
mDrawableName = "text_8001";
}
if(key=="رژیم غذائی و کاهش وزن"){
G.must_load_content = G.currentActivity.getString(R.string.content_text_8002);
mDrawableName = "text_8002";
}
if(key=="ورزش"){
G.must_load_content = G.currentActivity.getString(R.string.content_text_9001);
mDrawableName = "text_9001";
}
if(key=="ورزش موثر"){
//G.must_load_content = G.currentActivity.getString(R.string.content_text_9002);
distination_act = EfectiveSportActivity.class;
mDrawableName = "text_9002";
}
Resources res = G.currentActivity.getResources();
Log.i("LOG", "pont1 ");
int resID = res.getIdentifier(mDrawableName , "drawable", G.currentActivity.getPackageName());
Log.i("LOG", "pont2");
G.must_load_image_of_content = res.getDrawable(resID );
Log.i("LOG", "pont3");
Intent i = new Intent(G.currentActivity,distination_act);
Log.i("LOG", "pont4");
myAct.startActivity(i);
}
});
return convertView;
}
public int getChildrenCount(int groupPosition) {
return ((ArrayList<String>) Childtem.get(groupPosition)).size();
}
public Object getGroup(int groupPosition) {
return null;
}
public int getGroupCount() {
return groupItem.size();
}
@Override
public void onGroupCollapsed(int groupPosition) {
super.onGroupCollapsed(groupPosition);
}
@Override
public void onGroupExpanded(int groupPosition) {
super.onGroupExpanded(groupPosition);
}
public long getGroupId(int groupPosition) {
return 0;
}
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = minflater.inflate(R.layout.grouprow, null);
}
((CheckedTextView) convertView).setText(groupItem.get(groupPosition));
((CheckedTextView) convertView).setChecked(isExpanded);
return convertView;
}
public boolean hasStableIds() {
return false;
}
public boolean isChildSelectable(int groupPosition, int childPosition) {
return false;
}
public class HealthActivity extends ExpandableListActivity implements
OnChildClickListener {
ExpandableListView expandbleLis=null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
expandbleLis = getExpandableListView();
G.currentActivity = HealthActivity.this;
expandbleLis.setDividerHeight(3);
expandbleLis.setGroupIndicator(null);
expandbleLis.setClickable(true);
setGroupData();
setChildGroupData();
NewAdapter mNewAdapter = new NewAdapter(groupItem, childItem);
mNewAdapter
.setInflater((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE),this);
getExpandableListView().setAdapter(mNewAdapter);
expandbleLis.setOnChildClickListener(this);
}
public void setGroupData() {
groupItem.add("علائم هشدار دهنده");
groupItem.add("بیماری های جنسی");
groupItem.add("سلامت پروستات");
groupItem.add("سیستم قلبی عروقی");
groupItem.add("دیابت");
groupItem.add("سرطانها");
groupItem.add("اقدامات برای بهبود کیفیت زندگی");
groupItem.add("تغذیه");
groupItem.add("ورزش و توانائی جسمی");
}
ArrayList<String> groupItem = new ArrayList<String>();
ArrayList<Object> childItem = new ArrayList<Object>();
public void setChildGroupData() {
/**
* Add Data For TecthNology
*/
ArrayList<String> child = new ArrayList<String>();
child.add("تغییر در عادات روده ای و مثانه"); //string 1001
child.add("پشت درد مداوم، تغییر رنگ ادرار و مدفوع"); //string 1002
child.add("افسردگی"); //string 1003
childItem.add(child);
/**
* Add Data For Mobile
*/
child = new ArrayList<String>();
child.add("عفونت کلامیدیائی"); //string 2001
child.add("سوزاک"); //string 2002
child.add("سیفیلیس"); //string 2003
child.add("تبخال تناسلی"); //string 2004
child.add("زگیل تناسلی"); //string 2005
child.add("ایدز"); //string 2006
childItem.add(child);
/**
* Add Data For Manufacture
*/
child = new ArrayList<String>();
child.add("التهاب پروستات"); //string 3001
child.add("بزرگی خوش خیم پروستات"); //string 3002
child.add("سرطان پروستات"); //string 3003
childItem.add(child);
/**
* Add Data For Extras
*/
child = new ArrayList<String>();
child.add("افزایش فشار خون"); //string 4001
child.add("بیماری عروق کرونری قلب"); //string 4002
child.add("سکته قلبی"); //string 4003
childItem.add(child);
child = new ArrayList<String>();
child.add("دیابت"); //string 5001
childItem.add(child);
child = new ArrayList<String>();
child.add("سرطان بیضه"); //string 6001
childItem.add(child);
child = new ArrayList<String>();
child.add("زندگی سالم"); //string 7001
childItem.add(child);
child = new ArrayList<String>();
child.add("یک رژیم غذائی سالم به چه چیزی شبیه است؟"); //string 8001
child.add("رژیم غذائی و کاهش وزن"); //string 8002
childItem.add(child);
child = new ArrayList<String>();
child.add("ورزش"); //string 9001
child.add("ورزش موثر"); //string 9002
childItem.add(child);
}
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
Toast.makeText(HealthActivity.this, "Clicked On Child",
Toast.LENGTH_SHORT).show();
//parent.expandGroup(-1);
//parent.collapseGroup(groupPosition);
expandbleLis.collapseGroup(groupPosition);
return true;
}
}
import java.security.acl.Group;
import java.util.ArrayList;
import android.R.color;
import android.app.Activity;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.CheckedTextView;
import android.widget.TextView;
import android.widget.Toast;
@SuppressWarnings("unchecked")
public class NewAdapter extends BaseExpandableListAdapter {
public int previousGroup=-1;
public ArrayList<String> groupItem, tempChild;
public ArrayList<Object> Childtem = new ArrayList<Object>();
public LayoutInflater minflater;
public Activity activity=null;
public NewAdapter(ArrayList<String> grList, ArrayList<Object> childItem) {
groupItem = grList;
this.Childtem = childItem;
}
public void setInflater(LayoutInflater mInflater, Activity act) {
this.minflater = mInflater;
activity = act;
}
public Object getChild(int groupPosition, int childPosition) {
return null;
}
public long getChildId(int groupPosition, int childPosition) {
return 0;
}
public View getChildView(int groupPosition, final int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
convertView.setTag(groupPosition*100 + childPosition);
final int myGroupPos = groupPosition;
final DisplayMetrics dm = new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
previousGroup = myGroupPos;
tempChild = (ArrayList<String>) Childtem.get(groupPosition);
TextView text = null;
if (convertView == null) {
convertView = minflater.inflate(R.layout.childrow, null);
}
/*
text = (TextView) convertView.findViewById(R.id.textView1);
text.setText(tempChild.get(childPosition));
//typeface
text.setTypeface(G.typeFacePrs);
*/
//************
convertView.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Log.i("LOG", "childposition"+tempChild.get(childPosition));
ReportActivity.mahdiCustomToast(tempChild.get(childPosition), 1);
loadContent(tempChild.get(childPosition));
previousGroup = myGroupPos;
}
private void loadContent(String key) {
}
});
return convertView;
}
public int getChildrenCount(int groupPosition) {
return ((ArrayList<String>) Childtem.get(groupPosition)).size();
}
public Object getGroup(int groupPosition) {
return null;
}
public int getGroupCount() {
return groupItem.size();
}
@Override
public void onGroupCollapsed(int groupPosition) {
super.onGroupCollapsed(groupPosition);
}
@Override
public void onGroupExpanded(int groupPosition) {
super.onGroupExpanded(groupPosition);
}
public long getGroupId(int groupPosition) {
return 0;
}
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = minflater.inflate(R.layout.grouprow, null);
}
((CheckedTextView) convertView).setText(groupItem.get(groupPosition));
((CheckedTextView) convertView).setChecked(isExpanded);
return convertView;
}
public boolean hasStableIds() {
return false;
}
public boolean isChildSelectable(int groupPosition, int childPosition) {
return false;
}
}
12-21 10:37:42.628: D/libEGL(5084): loaded /system/lib/egl/libGLESv2_adreno200.so
12-21 10:37:42.628: I/Adreno200-EGL(5084): <qeglDrvAPI_eglInitialize:265>: EGL 1.4 QUALCOMM build: HAREESHG_Nondeterministic_AU+PATCH[ES]_msm8960_JB_1.9.6_MR2_CL3219408_release_ENGG (CL3219408)
12-21 10:37:42.628: I/Adreno200-EGL(5084): Build Date: 09/28/13 Sat
12-21 10:37:42.628: I/Adreno200-EGL(5084): Local Branch: hhh
12-21 10:37:42.628: I/Adreno200-EGL(5084): Remote Branch: quic/jb_1.9.6_1
12-21 10:37:42.628: I/Adreno200-EGL(5084): Local Patches: 8d50ec23e42ef52b570aa6ff1650afac0b503d78 CL3219408: Fix in the Glreadpixels for negative offsets and larger dimensions.
12-21 10:37:42.628: I/Adreno200-EGL(5084): 801859126f6ca69482b39a34ca61447e3f7cded8 rb: fix panel settings to clear undrawn/undefined buffers
12-21 10:37:42.628: I/Adreno200-EGL(5084): Reconstruct Branch: LOCAL_PATCH[ES]
12-21 10:37:42.718: D/OpenGLRenderer(5084): Enabling debug mode 0
12-21 10:37:42.728: D/OpenGLRenderer(5084): GL error from OpenGLRenderer: 0x502
12-21 10:37:42.728: E/OpenGLRenderer(5084): GL_INVALID_OPERATION
12-21 10:37:46.482: D/skia(5084): new locale
12-21 10:38:01.989: D/skia(5731): new locale
12-21 10:38:02.069: D/libEGL(5731): loaded /system/lib/egl/libEGL_adreno200.so
12-21 10:38:02.069: D/libEGL(5731): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
12-21 10:38:02.099: D/libEGL(5731): loaded /system/lib/egl/libGLESv2_adreno200.so
12-21 10:38:02.109: I/Adreno200-EGL(5731): <qeglDrvAPI_eglInitialize:265>: EGL 1.4 QUALCOMM build: HAREESHG_Nondeterministic_AU+PATCH[ES]_msm8960_JB_1.9.6_MR2_CL3219408_release_ENGG (CL3219408)
12-21 10:38:02.109: I/Adreno200-EGL(5731): Build Date: 09/28/13 Sat
12-21 10:38:02.109: I/Adreno200-EGL(5731): Local Branch: hhh
12-21 10:38:02.109: I/Adreno200-EGL(5731): Remote Branch: quic/jb_1.9.6_1
12-21 10:38:02.109: I/Adreno200-EGL(5731): Local Patches: 8d50ec23e42ef52b570aa6ff1650afac0b503d78 CL3219408: Fix in the Glreadpixels for negative offsets and larger dimensions.
12-21 10:38:02.109: I/Adreno200-EGL(5731): 801859126f6ca69482b39a34ca61447e3f7cded8 rb: fix panel settings to clear undrawn/undefined buffers
12-21 10:38:02.109: I/Adreno200-EGL(5731): Reconstruct Branch: LOCAL_PATCH[ES]
12-21 10:38:02.269: D/OpenGLRenderer(5731): Enabling debug mode 0
12-21 10:38:06.554: D/AbsListView(5731): Get MotionRecognitionManager
12-21 10:38:06.754: D/AbsListView(5731): unregisterIRListener() is called
12-21 10:38:06.934: D/AbsListView(5731): unregisterIRListener() is called
12-21 10:38:07.024: D/AbsListView(5731): unregisterIRListener() is called
12-21 10:38:08.145: D/AndroidRuntime(5731): Shutting down VM
12-21 10:38:08.155: W/dalvikvm(5731): threadid=1: thread exiting with uncaught exception (group=0x418dc898)
12-21 10:38:08.175: E/AndroidRuntime(5731): FATAL EXCEPTION: main
12-21 10:38:08.175: E/AndroidRuntime(5731): java.lang.NullPointerException
12-21 10:38:08.175: E/AndroidRuntime(5731): at com.tebsoft.his.NewAdapter.getChildView(NewAdapter.java:63)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.ExpandableListConnector.getView(ExpandableListConnector.java:455)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.AbsListView.obtainView(AbsListView.java:2624)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.ListView.makeAndAddView(ListView.java:1852)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.ListView.fillDown(ListView.java:682)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.ListView.fillSpecific(ListView.java:1345)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.ListView.layoutChildren(ListView.java:1645)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.AbsListView.onLayout(AbsListView.java:2444)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.View.layout(View.java:15221)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.ViewGroup.layout(ViewGroup.java:4793)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.View.layout(View.java:15221)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.ViewGroup.layout(ViewGroup.java:4793)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1677)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1531)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.LinearLayout.onLayout(LinearLayout.java:1440)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.View.layout(View.java:15221)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.ViewGroup.layout(ViewGroup.java:4793)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.View.layout(View.java:15221)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.ViewGroup.layout(ViewGroup.java:4793)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.View.layout(View.java:15221)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.ViewGroup.layout(ViewGroup.java:4793)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1677)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1531)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.LinearLayout.onLayout(LinearLayout.java:1440)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.View.layout(View.java:15221)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.ViewGroup.layout(ViewGroup.java:4793)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.View.layout(View.java:15221)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.ViewGroup.layout(ViewGroup.java:4793)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1677)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1531)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.LinearLayout.onLayout(LinearLayout.java:1440)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.View.layout(View.java:15221)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.ViewGroup.layout(ViewGroup.java:4793)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.View.layout(View.java:15221)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.ViewGroup.layout(ViewGroup.java:4793)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1677)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1531)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.LinearLayout.onLayout(LinearLayout.java:1440)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.View.layout(View.java:15221)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.ViewGroup.layout(ViewGroup.java:4793)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.View.layout(View.java:15221)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.ViewGroup.layout(ViewGroup.java:4793)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2260)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2007)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1249)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6364)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:791)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.Choreographer.doCallbacks(Choreographer.java:591)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.Choreographer.doFrame(Choreographer.java:561)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:777)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.os.Handler.handleCallback(Handler.java:730)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.os.Handler.dispatchMessage(Handler.java:92)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.os.Looper.loop(Looper.java:137)
12-21 10:38:08.175: E/AndroidRuntime(5731): at android.app.ActivityThread.main(ActivityThread.java:5455)
12-21 10:38:08.175: E/AndroidRuntime(5731): at java.lang.reflect.Method.invokeNative(Native Method)
12-21 10:38:08.175: E/AndroidRuntime(5731): at java.lang.reflect.Method.invoke(Method.java:525)
12-21 10:38:08.175: E/AndroidRuntime(5731): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
12-21 10:38:08.175: E/AndroidRuntime(5731): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
12-21 10:38:08.175: E/AndroidRuntime(5731): at dalvik.system.NativeStart.main(Native Method)
最佳答案
我可以对你说的第一件事是你必须对每个 View 使用标签,这样你就可以轻松地使用你的 View ,然后你不需要检查 key ,就像下面的代码:
convertView.setTag(groupPosition*100 + childPosition);
v.getTag()
这样的标签.这将为您提供独特的标签,您可以轻松获得您的 child 位置。
==
.您必须使用
.equal()
在字符串检查中。
seTag()
进入 getChildView()。
int chiledposClicked = v.getTag() % 100;
int groupPosClicked = v.getTag() / 100;
Childtem.get(groupPosClicked).get(chiledposClicked);
public View getChildView(int groupPosition, final int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
final int myGroupPos = groupPosition;
final DisplayMetrics dm = new DisplayMetrics();
activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
previousGroup = myGroupPos;
tempChild = (ArrayList<String>) Childtem.get(groupPosition);
TextView text = null;
if (convertView == null) {
convertView = minflater.inflate(R.layout.childrow, null);
}
convertView.setTag(groupPosition*100 + childPosition);
/*
text = (TextView) convertView.findViewById(R.id.textView1);
text.setText(tempChild.get(childPosition));
//typeface
text.setTypeface(G.typeFacePrs);
*/
//************
convertView.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
int chiledposClicked = v.getTag() % 100;
int groupPosClicked = v.getTag() / 100;
log.d("Group pos and child pos",""+groupPosClicked +" "+ chiledposClicked);
Childtem.get(groupPosClicked).get(chiledposClicked);
log.d("chiled is",Childtem.get(groupPosClicked).get(chiledposClicked));
ReportActivity.mahdiCustomToast(Childtem.get(groupPosClicked).get(chiledposClicked)
, 1);
loadContent(Childtem.get(groupPosClicked).get(chiledposClicked));
}
private void loadContent(String key) {
}
});
return convertView;
}
关于android - 一些 child 点击后可展开的 ListView 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19741502/
如何在代码中展开/折叠WPF扩展器?我需要这样做才能在其中初始化控件。 最佳答案 使用IsExpanded属性,将其设置为true以使内容可见: myExpander.IsExpanded = tru
Powershell 展开让我发疯。 我有以下代码可以从交换收件人处检索电子邮件地址。我使用 ArrayList 是因为当您希望能够从数组中删除项目时,很多人都建议使用它。 $aliases = Ne
是否可以展开/折叠数据表中的子表?我的子表包含与其上方行相关的信息,我想显示/隐藏图像的点击。只是想知道我会怎么做? 这是我目前使用的:
我正在尝试创建一个可扩展的文本区域,仅当该框为空时,该区域才会折叠回其原始高度。如果它不为空,那么我希望文本区域保持扩展并根据需要增长(即,当用户输入更多文本时增长)。文本区域永远不应该隐藏输入的文本
当尝试将 nestedSortable jQuery 插件与其网站上提供的示例一起使用时,该插件无法正常工作。 拖放可以工作,但是当我需要折叠/展开时就会出现问题。我使用了另一个问题中建议的解决方案,
我有一个显示嵌套数据的表。数据如下所示: Objective 1 Objective 1.1 Objective 1.1.1 Objective 1.2
我正在使用 jQuery 从屏幕左侧展开/缩回菜单栏。 这是我到目前为止所拥有的: $(document).ready(function(){ $('.menu-button').on("clic
如何根据类别向页面上的图像添加隐藏/显示(折叠/展开)功能? 我希望具有特定类的图像在加载时折叠,并在 JS 中定义一些任意标记(比方说, Show ),然后在扩展中具有不同的任意标记( Hide )
我需要在折叠和展开后触发事件调整大小。当我尝试使用 SWT.Collapse 和 SWT.Expand 执行此操作时,树上没有任何更改,因为它在发生之前就已触发。有什么办法吗? 最佳答案 尝试调用 D
我有一个如下所示的域: package object tryme { type ALL = AlarmMessage :+: PassMessage :+: HeyMessage :+: CNil
我有一个扩展器列表,我想用全局切换按钮控制其展开状态(IsExpanded),该按钮应该在展开/折叠状态之间切换。 到目前为止,我得到的解决方案是通过将扩展器的 IsExpanded 状态绑定(bin
我试图根据 QWidget 是否展开/折叠来自动调整其大小。我尝试了几种发布的方法here和 here . 我没有设法采用这些,以便它按照我想要的方式工作:我希望 QWidget 在展开时调整自身大小
我正在尝试显示对象模型(机器人)列表,这些模型有一个可以是另一个机器人的字段 Parent。 我已经使用 Django 的 MPTT 实现了一个嵌套列表: {% load mptt_tags %}
鉴于下表/代码,我想添加两项。我不太了解 JavaScript,这段代码是另一个程序员留下的。该代码在所有其他方面都按预期工作。 这是两个项目: 表格应该以折叠状态开始。所有节点都应该是崩溃到“祖 p
我想要一张可以展开或折叠的表格。我的要求是当我点击表格行然后隐藏行显示或者当我点击其他表格行然后上一个打开的行隐藏或显示相对隐藏行。我发现一个 jquery jxpand 非常适合我,它显示隐藏的行但
如果当您向下滚动页面时元素展开或折叠,页面会突然重置并且焦点会移动到页面顶部。 有什么方法可以防止页面移动或使其不那么突然? $(document).ready(function () {
我正在使用以下代码来扩展特定的线性布局,并且遵循了本教程 http://gmariotti.blogspot.sg/2013/09/expand-and-collapse-animation.html
当垂直偏移超过特定阈值时,如何使android中的可折叠工具栏自动折叠/展开? 例如,如果垂直偏移超过 getScrollRange() 的半点,则可折叠工具栏应自动展开,低于该阈值时应折叠。 最佳答
http://t-webdesign.co.uk/new/ 如何在不使用固定高度属性的情况下让灰色 div (#content_right) 扩展到与左侧 div 相同的大小? 谢谢 最佳答案 你可能
设置一个简单的 WordPress 博客,仅包含一个页面,即博客存档。但我遇到了一个问题,我想要切换摘录和内容显示更多/显示更少的功能,以便访问者可以轻松浏览同一页面上的帖子,而无需页面重新加载或被发
我是一名优秀的程序员,十分优秀!