I would like to inflate R.id.catText
, but it doesn't ever show if I inflate it by itself. If I inflate R.id.assets
(the container) then both elements show up just fine. I just don't want the container. How can I inflate R.id.catText
without inflating R.id.assets
?
Also, can I inflate R.id.catText
to an object? eg.
TextView catText = inflater.inflate(R.id.catText);
someView.addView(new catText());
my code:
LinearLayout myRoot = (LinearLayout) findViewById(R.id.assets);
LayoutInflater inflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.assets, myRoot, false);
my style:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1"
android:padding="50px" android:id="@+id/assets">
<TextView android:id="@+id/catText" android:text="TextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ff0000"></TextView>
</LinearLayout>