XMLファイルでビューを宣言しました。コードで定義したいのですが、設定しても何も表示されません。手伝って頂けますか?
これは私のXMLファイルです:
[...]
<View
android:id="@+id/marco_container"
style="@style/wrapFull"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
[...]
そして私はそれをこのように定義します:
setContentView(R.layout.marco);
View view = (View) findViewById(R.id.marco_container);
view.inflate(getApplicationContext(), R.layout.prueba, null);
私もこの方法でそれを宣言しようとしました:
view = View.inflate(getApplicationContext(), R.layout.prueba, null);
これはprueba.xmlです
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:text="Prueba" style="@style/wrapContent"
android:layout_gravity="center"/>
</FrameLayout>