0
我想將xml中的佈局加載到新創建的LinearLayout對象。那可能嗎?Android:從xml將佈局加載到新佈局
LinearLayout new_layout = new LinearLayout(context);
new_layout.load(R.layout.my_layout); // is something like this possible?
我想將xml中的佈局加載到新創建的LinearLayout對象。那可能嗎?Android:從xml將佈局加載到新佈局
LinearLayout new_layout = new LinearLayout(context);
new_layout.load(R.layout.my_layout); // is something like this possible?
什麼你想實現的是平時做這樣
LayoutInflater inflater = LayoutInflater.from(context);
LinearLayout newLayout = (LinearLayout) inflater.inflate(R.layout.my_layout, null);