{"id":50733,"date":"2023-12-23T10:31:39","date_gmt":"2023-12-23T02:31:39","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/android%e5%8f%af%e6%89%a9%e5%b1%95%e5%88%97%e8%a1%a8%e8%a7%86%e5%9b%be%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b%e3%80%82\/"},"modified":"2023-12-23T15:30:37","modified_gmt":"2023-12-23T07:30:37","slug":"android%e5%8f%af%e6%89%a9%e5%b1%95%e5%88%97%e8%a1%a8%e8%a7%86%e5%9b%be%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/android%e5%8f%af%e6%89%a9%e5%b1%95%e5%88%97%e8%a1%a8%e8%a7%86%e5%9b%be%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b%e3%80%82\/","title":{"rendered":"Android\u53ef\u6269\u5c55\u5217\u8868\u89c6\u56fe\u793a\u4f8b\u6559\u7a0b\u3002"},"content":{"rendered":"<p>\u6b22\u8fce\u6765\u5230Android ExpandableListView\u793a\u4f8b\u6559\u7a0b\u3002\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u5b9e\u73b0\u4e00\u4e2aExpandableListView\uff0c\u7528\u4e8e\u6309\u7c7b\u522b\u5bf9\u5217\u8868\u6570\u636e\u8fdb\u884c\u5206\u7ec4\u3002\u5b83\u7c7b\u4f3c\u4e8eAndroid ListView\u4e2d\u7684\u83dc\u5355\u548c\u5b50\u83dc\u5355\u3002<\/p>\n<h2>\u5b89\u5353\u53ef\u5c55\u5f00\u5217\u8868<\/h2>\n<p>Android\u7684ExpandableListView\u662f\u4e00\u79cd\u89c6\u56fe\uff0c\u5b83\u4ee5\u5782\u76f4\u6eda\u52a8\u7684\u4e24\u7ea7\u5217\u8868\u663e\u793a\u9879\u76ee\u3002\u5b83\u4e0eListView\u4e0d\u540c\u4e4b\u5904\u5728\u4e8e\uff0c\u5b83\u5141\u8bb8\u4e24\u7ea7\uff0c\u5176\u4e2d\u7684\u5206\u7ec4\u53ef\u4ee5\u901a\u8fc7\u89e6\u6478\u5c55\u5f00\u548c\u6298\u53e0\u4ee5\u8fdb\u884c\u67e5\u770b\uff0c\u5e76\u4e14\u8fd8\u6709\u5b83\u4eec\u5404\u81ea\u7684\u5b50\u9879\u76ee\u3002\u5728Android\u4e2d\uff0cExpandableListViewAdapter\u5c06\u6570\u636e\u52a0\u8f7d\u5230\u4e0e\u8be5\u89c6\u56fe\u76f8\u5173\u8054\u7684\u9879\u76ee\u4e2d\u3002\u4ee5\u4e0b\u662f\u8be5\u7c7b\u4f7f\u7528\u7684\u4e00\u4e9b\u91cd\u8981\u65b9\u6cd5\u3002<\/p>\n<ul class=\"post-ul\">\n<li>setChildIndicator(Drawable) : This is used to show an indicator besides each item representing the current state. If the child is the last child for a group, the state state_last will be set<\/li>\n<li>setGroupIndicator(Drawable) : An indicator is drawn besides the group representing its state i.e. expanded or collapsed. If the group is empty, the state state_empty will be set. If the group is expanded, the state state_expanded will be set<\/li>\n<li>getGroupView() : It returns view for the list group header<\/li>\n<li>getChildView() : It returns view for list child item<\/li>\n<\/ul>\n<p>\u672c\u7c7b\u6240\u5b9e\u73b0\u7684\u663e\u8457\u63a5\u53e3\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<ul class=\"post-ul\">\n<li>ExpandableListView.OnChildClickListener : This is overridden to implement the callback method that\u2019s invoked when a child in the expanded list is clicked<\/li>\n<li>ExpandableListView.OnGroupClickListener : This is overridden to implement the callback method that\u2019s invoked when a group header in the expanded list is clicked<\/li>\n<li>ExpandableListView.OnGroupCollapseListener : It is used for notifying when a group is collapsed<\/li>\n<li>ExpandableListView.OnGroupExpandListener : It is used to notify when a group is expanded<\/li>\n<\/ul>\n<h3>\u5b89\u5353\u53ef\u6269\u5c55\u5217\u8868\u89c6\u56fe\u9879\u76ee\u7ed3\u6784<\/h3>\n<p>\u8fd9\u4e2a\u9879\u76ee\u7531\u4e09\u95e8\u8bfe\u7a0b\u7ec4\u6210\u3002<\/p>\n<ul class=\"post-ul\">\n<li>A MainActivity that shows the layout with the ExpandableListView<\/li>\n<li>An ExpandableListDataPump which represents a random data in a List and maps the child item data to the respective group headers using a HashMap<\/li>\n<li>A CustomExpandableListAdapter which provides the MainActivity with the data from the ExpandableListDataPump class\/li><\/li>\n<\/ul>\n<h3>\u5b89\u5353\u53ef\u6269\u5c55\u5217\u8868\u89c6\u56fe\u7684\u4ee3\u7801\u5b9e\u73b0<\/h3>\n<p>activity_main.xml\u5e03\u5c40\u5305\u542b\u4e00\u4e2aExpandableListView\u5728\u4e00\u4e2aRelativeLayout\u4e2d\uff0c\u5982\u4e0b\u6240\u793a\uff1aactivity_main.xml<\/p>\n<pre class=\"post-pre\"><code>&lt;RelativeLayout xmlns:android=\"https:\/\/schemas.android.com\/apk\/res\/android\"\r\n    xmlns:tools=\"https:\/\/schemas.android.com\/tools\"\r\n    android:layout_width=\"match_parent\"\r\n    android:layout_height=\"match_parent\"\r\n    android:paddingLeft=\"@dimen\/activity_horizontal_margin\"\r\n    android:paddingRight=\"@dimen\/activity_horizontal_margin\"\r\n    android:paddingTop=\"@dimen\/activity_vertical_margin\"\r\n    android:paddingBottom=\"@dimen\/activity_vertical_margin\"\r\n    tools:context=\".MainActivity\"&gt;\r\n\r\n    &lt;ExpandableListView\r\n        android:id=\"@+id\/expandableListView\"\r\n        android:layout_height=\"match_parent\"\r\n        android:layout_width=\"match_parent\"\r\n        android:indicatorLeft=\"?android:attr\/expandableListPreferredItemIndicatorLeft\"\r\n        android:divider=\"@android:color\/darker_gray\"\r\n        android:dividerHeight=\"0.5dp\" \/&gt;\r\n\r\n&lt;\/RelativeLayout&gt;\r\n<\/code><\/pre>\n<p>android:indicatorLeft \u662f\u4e00\u4e2a\u9879\u76ee\u6307\u793a\u5668\u7684\u5de6\u8fb9\u754c\u3002\u6ce8\u610f\uff1a\u9664\u975e\u5728XML\u4e2d\u660e\u786e\u6307\u5b9a\u4e86\u7236\u9879\u7684\u5927\u5c0f\uff0c\u5426\u5219\u4e0d\u80fd\u5bf9 ExpandableListView \u7684 android:layout_height \u5c5e\u6027\u4f7f\u7528 wrap_content \u503c\u3002\u6bcf\u4e2a\u5355\u72ec\u5217\u8868\u7684\u7ec4\u5934\u5e03\u5c40\u5982\u4e0b\u6240\u793a\uff1alist_group.xml<\/p>\n<pre class=\"post-pre\"><code>&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n\r\n&lt;LinearLayout xmlns:android=\"https:\/\/schemas.android.com\/apk\/res\/android\"\r\n    android:orientation=\"vertical\" android:layout_width=\"match_parent\"\r\n    android:layout_height=\"match_parent\"&gt;\r\n    &lt;TextView\r\n        android:id=\"@+id\/listTitle\"\r\n        android:layout_width=\"fill_parent\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:paddingLeft=\"?android:attr\/expandableListPreferredItemPaddingLeft\"\r\n        android:textColor=\"@android:color\/black\"\r\n        android:paddingTop=\"10dp\"\r\n        android:paddingBottom=\"10dp\" \/&gt;\r\n&lt;\/LinearLayout&gt;\r\n<\/code><\/pre>\n<p>\u5b50\u9879\u7684\u5e03\u5c40\u884c\u5728\u4e0b\u9762\u7ed9\u51fa\uff1alist_item.xml<\/p>\n<pre class=\"post-pre\"><code>&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n\r\n&lt;LinearLayout xmlns:android=\"https:\/\/schemas.android.com\/apk\/res\/android\"\r\n    android:orientation=\"vertical\" android:layout_width=\"match_parent\"\r\n    android:layout_height=\"wrap_content\"&gt;\r\n    &lt;TextView\r\n        android:id=\"@+id\/expandedListItem\"\r\n        android:layout_width=\"fill_parent\"\r\n        android:layout_height=\"wrap_content\"\r\n        android:paddingLeft=\"?android:attr\/expandableListPreferredChildPaddingLeft\"\r\n        android:paddingTop=\"10dp\"\r\n        android:paddingBottom=\"10dp\" \/&gt;\r\n&lt;\/LinearLayout&gt;\r\n<\/code><\/pre>\n<p>\u5b9a\u4e49\u5982\u4e0b\uff1aExpandableListDataPump\u7c7b\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.Olivia.expandablelistview;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.HashMap;\r\nimport java.util.List;\r\n\r\npublic class ExpandableListDataPump {\r\n    public static HashMap&lt;String, List&lt;String&gt;&gt; getData() {\r\n        HashMap&lt;String, List&lt;String&gt;&gt; expandableListDetail = new HashMap&lt;String, List&lt;String&gt;&gt;();\r\n\r\n        List&lt;String&gt; cricket = new ArrayList&lt;String&gt;();\r\n        cricket.add(\"India\");\r\n        cricket.add(\"Pakistan\");\r\n        cricket.add(\"Australia\");\r\n        cricket.add(\"England\");\r\n        cricket.add(\"South Africa\");\r\n\r\n        List&lt;String&gt; football = new ArrayList&lt;String&gt;();\r\n        football.add(\"Brazil\");\r\n        football.add(\"Spain\");\r\n        football.add(\"Germany\");\r\n        football.add(\"Netherlands\");\r\n        football.add(\"Italy\");\r\n\r\n        List&lt;String&gt; basketball = new ArrayList&lt;String&gt;();\r\n        basketball.add(\"United States\");\r\n        basketball.add(\"Spain\");\r\n        basketball.add(\"Argentina\");\r\n        basketball.add(\"France\");\r\n        basketball.add(\"Russia\");\r\n\r\n        expandableListDetail.put(\"CRICKET TEAMS\", cricket);\r\n        expandableListDetail.put(\"FOOTBALL TEAMS\", football);\r\n        expandableListDetail.put(\"BASKETBALL TEAMS\", basketball);\r\n        return expandableListDetail;\r\n    }\r\n}\r\n<\/code><\/pre>\n<p>\u5728\u4e0a\u8ff0\u4ee3\u7801\u4e2d\uff0cexpandableListDetail\u5bf9\u8c61\u4f7f\u7528String\u7684ArrayList\u5c06\u7ec4\u5934\u5b57\u7b26\u4e32\u6620\u5c04\u5230\u5b83\u4eec\u5bf9\u5e94\u7684\u5b50\u9879\u4e0a\u3002CustomExpandableListAdapter.java\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.Olivia.expandablelistview;\r\n\r\nimport java.util.HashMap;\r\nimport java.util.List;\r\nimport android.content.Context;\r\nimport android.graphics.Typeface;\r\nimport android.view.LayoutInflater;\r\nimport android.view.View;\r\nimport android.view.ViewGroup;\r\nimport android.widget.BaseExpandableListAdapter;\r\nimport android.widget.TextView;\r\n\r\npublic class CustomExpandableListAdapter extends BaseExpandableListAdapter {\r\n\r\n    private Context context;\r\n    private List&lt;String&gt; expandableListTitle;\r\n    private HashMap&lt;String, List&lt;String&gt;&gt; expandableListDetail;\r\n\r\n    public CustomExpandableListAdapter(Context context, List&lt;String&gt; expandableListTitle,\r\n                                       HashMap&lt;String, List&lt;String&gt;&gt; expandableListDetail) {\r\n        this.context = context;\r\n        this.expandableListTitle = expandableListTitle;\r\n        this.expandableListDetail = expandableListDetail;\r\n    }\r\n\r\n    @Override\r\n    public Object getChild(int listPosition, int expandedListPosition) {\r\n        return this.expandableListDetail.get(this.expandableListTitle.get(listPosition))\r\n                .get(expandedListPosition);\r\n    }\r\n\r\n    @Override\r\n    public long getChildId(int listPosition, int expandedListPosition) {\r\n        return expandedListPosition;\r\n    }\r\n\r\n    @Override\r\n    public View getChildView(int listPosition, final int expandedListPosition,\r\n                             boolean isLastChild, View convertView, ViewGroup parent) {\r\n        final String expandedListText = (String) getChild(listPosition, expandedListPosition);\r\n        if (convertView == null) {\r\n            LayoutInflater layoutInflater = (LayoutInflater) this.context\r\n                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);\r\n            convertView = layoutInflater.inflate(R.layout.list_item, null);\r\n        }\r\n        TextView expandedListTextView = (TextView) convertView\r\n                .findViewById(R.id.expandedListItem);\r\n        expandedListTextView.setText(expandedListText);\r\n        return convertView;\r\n    }\r\n\r\n    @Override\r\n    public int getChildrenCount(int listPosition) {\r\n        return this.expandableListDetail.get(this.expandableListTitle.get(listPosition))\r\n                .size();\r\n    }\r\n\r\n    @Override\r\n    public Object getGroup(int listPosition) {\r\n        return this.expandableListTitle.get(listPosition);\r\n    }\r\n\r\n    @Override\r\n    public int getGroupCount() {\r\n        return this.expandableListTitle.size();\r\n    }\r\n\r\n    @Override\r\n    public long getGroupId(int listPosition) {\r\n        return listPosition;\r\n    }\r\n\r\n    @Override\r\n    public View getGroupView(int listPosition, boolean isExpanded,\r\n                             View convertView, ViewGroup parent) {\r\n        String listTitle = (String) getGroup(listPosition);\r\n        if (convertView == null) {\r\n            LayoutInflater layoutInflater = (LayoutInflater) this.context.\r\n                    getSystemService(Context.LAYOUT_INFLATER_SERVICE);\r\n            convertView = layoutInflater.inflate(R.layout.list_group, null);\r\n        }\r\n        TextView listTitleTextView = (TextView) convertView\r\n                .findViewById(R.id.listTitle);\r\n        listTitleTextView.setTypeface(null, Typeface.BOLD);\r\n        listTitleTextView.setText(listTitle);\r\n        return convertView;\r\n    }\r\n\r\n    @Override\r\n    public boolean hasStableIds() {\r\n        return false;\r\n    }\r\n\r\n    @Override\r\n    public boolean isChildSelectable(int listPosition, int expandedListPosition) {\r\n        return true;\r\n    }\r\n}\r\n<\/code><\/pre>\n<p>\u8fd9\u4e2a\u7c7b\u7ee7\u627f\u81eaBaseExpandableListAdapter\uff0c\u5e76\u8986\u76d6\u4e86\u57fa\u7c7b\u4e2d\u7684\u65b9\u6cd5\uff0c\u4e3aExpandableListView\u63d0\u4f9b\u89c6\u56fe\u3002getView()\u65b9\u6cd5\u4f7f\u7528\u7ed9\u5b9a\u7684\u7d22\u5f15\u5c06\u6570\u636e\u586b\u5145\u5230\u9879\u7684\u89c6\u56fe\u4e2d\u3002MainActivity.java\u6587\u4ef6\u3002<\/p>\n<pre class=\"post-pre\"><code>package com.Olivia.expandablelistview;\r\n\r\nimport android.support.v7.app.AppCompatActivity;\r\nimport android.os.Bundle;\r\nimport android.view.View;\r\nimport android.widget.ExpandableListAdapter;\r\nimport android.widget.ExpandableListView;\r\nimport android.widget.Toast;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.HashMap;\r\nimport java.util.List;\r\n\r\npublic class MainActivity extends AppCompatActivity {\r\n\r\n    ExpandableListView expandableListView;\r\n    ExpandableListAdapter expandableListAdapter;\r\n    List&lt;String&gt; expandableListTitle;\r\n    HashMap&lt;String, List&lt;String&gt;&gt; expandableListDetail;\r\n\r\n    @Override\r\n    protected void onCreate(Bundle savedInstanceState) {\r\n        super.onCreate(savedInstanceState);\r\n        setContentView(R.layout.activity_main);\r\n        expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);\r\n        expandableListDetail = ExpandableListDataPump.getData();\r\n        expandableListTitle = new ArrayList&lt;String&gt;(expandableListDetail.keySet());\r\n        expandableListAdapter = new CustomExpandableListAdapter(this, expandableListTitle, expandableListDetail);\r\n        expandableListView.setAdapter(expandableListAdapter);\r\n        expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {\r\n\r\n            @Override\r\n            public void onGroupExpand(int groupPosition) {\r\n                Toast.makeText(getApplicationContext(),\r\n                        expandableListTitle.get(groupPosition) + \" List Expanded.\",\r\n                        Toast.LENGTH_SHORT).show();\r\n            }\r\n        });\r\n\r\n        expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {\r\n\r\n            @Override\r\n            public void onGroupCollapse(int groupPosition) {\r\n                Toast.makeText(getApplicationContext(),\r\n                        expandableListTitle.get(groupPosition) + \" List Collapsed.\",\r\n                        Toast.LENGTH_SHORT).show();\r\n\r\n            }\r\n        });\r\n\r\n        expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {\r\n            @Override\r\n            public boolean onChildClick(ExpandableListView parent, View v,\r\n                                        int groupPosition, int childPosition, long id) {\r\n                Toast.makeText(\r\n                        getApplicationContext(),\r\n                        expandableListTitle.get(groupPosition)\r\n                                + \" -&gt; \"\r\n                                + expandableListDetail.get(\r\n                                expandableListTitle.get(groupPosition)).get(\r\n                                childPosition), Toast.LENGTH_SHORT\r\n                ).show();\r\n                return false;\r\n            }\r\n        });\r\n    }\r\n\r\n}\r\n<\/code><\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u4ee3\u7801\u4e2d\uff0c\u6211\u4eec\u5b9e\u73b0\u4e86\u4e4b\u524d\u8ba8\u8bba\u8fc7\u7684\u6240\u6709\u63a5\u53e3\u3002\u51fa\u4e8e\u7b80\u5355\u8d77\u89c1\uff0c\u6211\u4eec\u53ea\u4f1a\u5728\u6bcf\u6b21\u70b9\u51fb\u65f6\u663e\u793a\u4e00\u4e2aToast\uff0c\u5176\u4e2d\u5305\u542b\u9879\u76ee\u7684\u540d\u79f0\u6216\u7ec4\u7684\u72b6\u6001\u3002\u4f46\u8fd9\u4e9b\u53ef\u4ee5\u5f88\u5bb9\u6613\u5730\u4fee\u6539\u4e3a\u6267\u884c\u4efb\u4f55\u5176\u4ed6\u64cd\u4f5c\u3002\u4e0b\u9762\u662f\u6211\u4eec\u7684\u5e94\u7528\u7a0b\u5e8f\u5728 Android \u53ef\u5c55\u5f00\u5217\u8868\u89c6\u56fe\u4e2d\u7684\u64cd\u4f5c\u3002\u6ce8\u610f\uff1aExpandableListViews \u672c\u8eab\u662f\u53ef\u4ee5\u6eda\u52a8\u7684\u3002\u8fd9\u5c31\u7ed3\u675f\u4e86 Android ExpandableListView \u7684\u6559\u7a0b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6b22\u8fce\u6765\u5230Android ExpandableListView\u793a\u4f8b\u6559\u7a0b\u3002\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u5b9e\u73b0\u4e00\u4e2aExpanda [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-50733","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Android\u53ef\u6269\u5c55\u5217\u8868\u89c6\u56fe\u793a\u4f8b\u6559\u7a0b\u3002 - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/android\u53ef\u6269\u5c55\u5217\u8868\u89c6\u56fe\u793a\u4f8b\u6559\u7a0b\u3002\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Android\u53ef\u6269\u5c55\u5217\u8868\u89c6\u56fe\u793a\u4f8b\u6559\u7a0b\u3002\" \/>\n<meta property=\"og:description\" content=\"\u6b22\u8fce\u6765\u5230Android ExpandableListView\u793a\u4f8b\u6559\u7a0b\u3002\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u5b9e\u73b0\u4e00\u4e2aExpanda [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/android\u53ef\u6269\u5c55\u5217\u8868\u89c6\u56fe\u793a\u4f8b\u6559\u7a0b\u3002\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-12-23T02:31:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-23T07:30:37+00:00\" \/>\n<meta name=\"author\" content=\"\u96c5, \u609f\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u96c5, \u609f\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/android%e5%8f%af%e6%89%a9%e5%b1%95%e5%88%97%e8%a1%a8%e8%a7%86%e5%9b%be%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b%e3%80%82\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/android%e5%8f%af%e6%89%a9%e5%b1%95%e5%88%97%e8%a1%a8%e8%a7%86%e5%9b%be%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b%e3%80%82\/\",\"name\":\"Android\u53ef\u6269\u5c55\u5217\u8868\u89c6\u56fe\u793a\u4f8b\u6559\u7a0b\u3002 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-12-23T02:31:39+00:00\",\"dateModified\":\"2023-12-23T07:30:37+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/android%e5%8f%af%e6%89%a9%e5%b1%95%e5%88%97%e8%a1%a8%e8%a7%86%e5%9b%be%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b%e3%80%82\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/android%e5%8f%af%e6%89%a9%e5%b1%95%e5%88%97%e8%a1%a8%e8%a7%86%e5%9b%be%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b%e3%80%82\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/android%e5%8f%af%e6%89%a9%e5%b1%95%e5%88%97%e8%a1%a8%e8%a7%86%e5%9b%be%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b%e3%80%82\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Android\u53ef\u6269\u5c55\u5217\u8868\u89c6\u56fe\u793a\u4f8b\u6559\u7a0b\u3002\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\",\"name\":\"\u96c5, \u609f\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"caption\":\"\u96c5, \u609f\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/android%e5%8f%af%e6%89%a9%e5%b1%95%e5%88%97%e8%a1%a8%e8%a7%86%e5%9b%be%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b%e3%80%82\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Android\u53ef\u6269\u5c55\u5217\u8868\u89c6\u56fe\u793a\u4f8b\u6559\u7a0b\u3002 - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/android\u53ef\u6269\u5c55\u5217\u8868\u89c6\u56fe\u793a\u4f8b\u6559\u7a0b\u3002\/","og_locale":"zh_CN","og_type":"article","og_title":"Android\u53ef\u6269\u5c55\u5217\u8868\u89c6\u56fe\u793a\u4f8b\u6559\u7a0b\u3002","og_description":"\u6b22\u8fce\u6765\u5230Android ExpandableListView\u793a\u4f8b\u6559\u7a0b\u3002\u5728\u672c\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u5b9e\u73b0\u4e00\u4e2aExpanda [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/android\u53ef\u6269\u5c55\u5217\u8868\u89c6\u56fe\u793a\u4f8b\u6559\u7a0b\u3002\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-12-23T02:31:39+00:00","article_modified_time":"2023-12-23T07:30:37+00:00","author":"\u96c5, \u609f","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u96c5, \u609f","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/android%e5%8f%af%e6%89%a9%e5%b1%95%e5%88%97%e8%a1%a8%e8%a7%86%e5%9b%be%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b%e3%80%82\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/android%e5%8f%af%e6%89%a9%e5%b1%95%e5%88%97%e8%a1%a8%e8%a7%86%e5%9b%be%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b%e3%80%82\/","name":"Android\u53ef\u6269\u5c55\u5217\u8868\u89c6\u56fe\u793a\u4f8b\u6559\u7a0b\u3002 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-12-23T02:31:39+00:00","dateModified":"2023-12-23T07:30:37+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/android%e5%8f%af%e6%89%a9%e5%b1%95%e5%88%97%e8%a1%a8%e8%a7%86%e5%9b%be%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b%e3%80%82\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/android%e5%8f%af%e6%89%a9%e5%b1%95%e5%88%97%e8%a1%a8%e8%a7%86%e5%9b%be%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b%e3%80%82\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/android%e5%8f%af%e6%89%a9%e5%b1%95%e5%88%97%e8%a1%a8%e8%a7%86%e5%9b%be%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b%e3%80%82\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"Android\u53ef\u6269\u5c55\u5217\u8868\u89c6\u56fe\u793a\u4f8b\u6559\u7a0b\u3002"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6","name":"\u96c5, \u609f","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","caption":"\u96c5, \u609f"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/android%e5%8f%af%e6%89%a9%e5%b1%95%e5%88%97%e8%a1%a8%e8%a7%86%e5%9b%be%e7%a4%ba%e4%be%8b%e6%95%99%e7%a8%8b%e3%80%82\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/50733","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=50733"}],"version-history":[{"count":1,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/50733\/revisions"}],"predecessor-version":[{"id":50798,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/50733\/revisions\/50798"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=50733"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=50733"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=50733"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}