How can I set view of layout with using LayoutInflater
. It means i need take view on Layout and set this on other layout
something like this
LayoutInflater layoutInflater = (LayoutInflater) this.getSystemService(this.LAYOUT_INFLATER_SERVICE);
View v = layoutInflater.inflate(R.layout.activity_strona_glowna,null);
LinearLayout a = findViewById(R.id.MainLayout);
i want to set layoutInflater
on view of 'a'
您可以通过使用 addView() 方法来做到这一点。
a.addView(v);
'findViewById' returns a view, please convert it to a LinearLayout
.
LinearLayout a = (LinearLayout)findViewById(R.id.MainLayout);
a.addView(v);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.