在scrollview中不显示任何内容

时间:2018-06-26 20:22:31

标签: android android-scrollview

    MainView root = findViewById(R.id.rootPanel);
    TableView tableview = createTableView();
    ScrollView scrollview = new ScrollView(this);
    scrollview.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT));

    scrollview.addView(tableview);
    root.addView(scrollview);

当我尝试将自定义表格布局添加到滚动视图时,什么都没有出现。但是scrollview可以识别表布局(我从wrap_content可以理解)。如果我将滚动视图替换为其他布局,则效果很好。

1 个答案:

答案 0 :(得分:0)

我解决了。我在scrollview和表布局之间添加了一个中间层,它起作用了。

ScrollView <-LinearLayout <-TableLayout

相关问题