我创建了一个树作为双重可扩展列表视图,其中一个项目比其他项目有更多的孩子(15),并没有显示他的所有孩子.
_ ______
+|_______|
_______
+|_______|
_______
|_______|
_______
|_______|
...
...
_______
|_______| // 11-th item
_______ // 12-th item can be seen a little and it-s clickable
_______
+|_______|
_______
+|_______|
...
...
_______
+|_______|
Run Code Online (Sandbox Code Playgroud)
在第12个项目之后,列表被删除.我没有对列表的大小施加任何约束.知道为什么会这样吗?谢谢!
编辑 这是第一个可扩展列表的代码.
<ExpandableListView android:layout_width="fill_parent" android:id="@+id/ParentLevel"
android:groupIndicator="@null" android:choiceMode="singleChoice"
android:layout_height="fill_parent"
android:layout_above="@id/button_layout"
android:paddingRight="5dp">
Run Code Online (Sandbox Code Playgroud)
另一个子列表添加在适配器getView()方法中.
代码示例
//MainActivity.java
public class MainActivity extends Activity implements OnChildClickListener {
ExpandableListView elv;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// QUI SOTTO
Tree root = new Tree("root", 123);
for (int i …Run Code Online (Sandbox Code Playgroud)