【发布时间】:2013-09-16 05:33:11
【问题描述】:
这是我以编程方式在滚动视图底部显示按钮的代码。但仅显示滚动视图。按钮未显示在屏幕上。如何解决此问题。
LinearLayout ll = new LinearLayout(this);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
ll.setLayoutParams(lp);
ScrollView scrollView = new ScrollView(this);
TableLayout resultLayout = new TableLayout(this);
resultLayout.setStretchAllColumns(true);
resultLayout.setShrinkAllColumns(true);
scrollView.addView(resultLayout);
ll.addView(scrollView);
Button btn = new Button(this);
ViewGroup.LayoutParams blp = new ViewGroup.LayoutParams(
LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT);
btn.setLayoutParams(blp);
btn.setText("Click Me");
//ll.addView(rl1);
ll.addView(btn);
setContentView(ll);
包含的滚动视图屏幕
【问题讨论】:
-
我不明白你有什么问题?
-
这里我想在滚动视图的底部放置一个按钮,但只显示滚动视图
-
ll.setOrientation(LinearLayout.VERTICAL);添加这个。@Prabha
-
那么按钮也没有显示在滚动视图的底部
-
张贴你正在尝试和得到的内容的屏幕截图
标签: android android-button android-scrollview