hy,我在滚动视图上有一个可扩展的列表。视图是滚动的,但我的可扩展列表不滚动。有什么建议吗? 这是list的代码。我还将属性中列表的可滚动属性设置为true,但没有结果?列表中的项目是可点击的,他们回复点击,但列表仍然没有流口水。请咨询..
ExpandableListView listview= (ExpandableListView) findViewById(R.id.expandableListView1);
GundamExpAdapter gea = new GundamExpAdapter(this);
ArrayList<String> models = new ArrayList<String>();
models.add("Turn on silent profile");
models.add("Turn off silent profile");
models.add("Turn on wifi");
models.add("Turn off wifi");
models.add("Turn on gps");
models.add("Turn off gps");
gea.AddGroup("Functionalities", models);
listview.setAdapter(gea);
//ExpandableListView elv = getExpandableListView();
listview.setTextFilterEnabled(true);
listview.setEnabled(true);
这是我列表的适配器:
public class GundamExpAdapter extends BaseExpandableListAdapter
{
/*-------------------------- Fields --------------------------*/
private final HashMap<String, ArrayList<String>> myData = new HashMap<String, ArrayList<String>>();
private final HashMap<Integer, String> lookUp = new HashMap<Integer, String>();
private final Context context;
public class ViewHolder {
TextView textView;
}
/*-------------------------- Public --------------------------*/
public GundamExpAdapter(final Context con)
{
context = con;
}
public boolean AddGroup(final String groupName, final ArrayList<String> list)
{
final ArrayList<String> prev = myData.put(groupName, list);
if (prev != null)
return false;
lookUp.put(myData.size() - 1, groupName);
notifyDataSetChanged();
return true;
}
public Object getChild(int groupPos, int childPos)
{
if (lookUp.containsKey(groupPos))
{
final String str = lookUp.get(groupPos);
final ArrayList<String> data = myData.get(str);
return data.get(childPos);
}
return null;
}
public long getChildId(int groupPos, int childPos)
{
return 0;
}
public View getChildView(int groupPos, int childPos, boolean isLastChild,
View convertView, ViewGroup parent)
{
if (convertView == null) {
LayoutInflater infalInflater = LayoutInflater.from(context);
convertView = infalInflater.inflate(R.layout.childrow, null);
}
TextView textView = (TextView) convertView.findViewById(R.id.textView1row);
textView.setText(getChild(groupPos, childPos).toString());
textView.setTypeface(font);
return convertView;
}
public int getChildrenCount(int groupPos)
{
if (lookUp.containsKey(groupPos))
return myData.get(lookUp.get(groupPos)).size();
return 0;
}
public Object getGroup(int groupPos)
{
if (lookUp.containsKey(groupPos))
return myData.get(lookUp.get(groupPos));
return null;
}
public int getGroupCount()
{
return myData.size();
}
public long getGroupId(int groupPos)
{
return 0;
}
public View getGroupView(int groupPos, boolean isExpanded, View convertView, ViewGroup parent)
{
ViewHolder holder = null;
if (convertView == null) {
holder = new ViewHolder();
LayoutInflater infalInflater = LayoutInflater.from(context);
convertView = infalInflater.inflate(R.layout.childrow, null,
false);
holder.textView = (TextView) convertView
.findViewById(R.id.textView1row);
//Log.d("heading", getGroup(groupPosition).toString());
holder.textView.setText("Functionalities");
holder.textView.setPadding(50, 0, 0, 0);
holder.textView.setTypeface(font);
holder.textView.setTextSize(22);
holder.textView.setTextColor(android.R.color.darker_gray);
}
return convertView;
}
public boolean hasStableIds()
{
return false;
}
public boolean isChildSelectable(int groupPos, int childPos)
{
return true;
}
}
enter code here