我正在尝试以编程方式将线性布局垂直放置在线性布局内,但它似乎不起作用,按钮没有出现,但文本视图出现......
这是我的代码:(这是一个对话框..)
LinearLayout titleLayout = new LinearLayout(m_context);
titleLayout.setOrientation(LinearLayout.VERTICAL);
m_titleView = new TextView(m_context);
m_titleView.setText(title);
LinearLayout horizontalLayout = new LinearLayout(m_context);
titleLayout.setOrientation(LinearLayout.HORIZONTAL);
Button backward = new Button(m_context);
backward.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
backward.setText("Backwards");
Button newDirButton = new Button(m_context);
newDirButton.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
newDirButton.setText("New folder");
horizontalLayout.addView(backward);
horizontalLayout.addView(newDirButton);
titleLayout.addView(m_titleView);
titleLayout.addView(horizontalLayout);
提前致谢!