Dưới đây là mã của tôiLàm thế nào để khai báo nội dung quấn vào một nút năng động trong mã
Button myButton = new Button(this);
myButton.setText("Press Me");
myButton.setTextColor(Color.WHITE);
LinearLayout layout = (LinearLayout) findViewById(R.id.linearLayout1);
layout.addView(myButton);
Làm thế nào để thêm wrapcontent
để nút này?
nhờ myButton.setLayoutParams (LayoutParams mới (LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); đã làm việc cho tôi – Sando
hehe yeah bạn cần nó cho nút của tôi! Tôi nghĩ cho bố trí :) cùng một điều –