我正在尝试通过 xml 来实现这一点,但尝试失败的次数太多。我尝试创建两个按钮并通过 ViewId 调用它们,但由于它们是自定义按钮,因此它们不会显示在 UI 上。我该怎么办?
LinearLayout ll = new LinearLayout(this);
recButton = new CustomRecordButton(this);
ll.addView(recButton,
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT,0));
playButton = new CustomPlayButton(this);
ll.addView(playButton, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT,0));
setContentView(ll);