Android へのコーディングは初めてですが、この特定の問題に対する答えが見つかりませんでした。次の XML レイアウトがあるとします。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<view class="com.example.testapp.customView"
android:id="@+id/drawView"
android:layout_height="100dp"
android:layout_width="fill_parent" />
<Button android:id="@+id/bNormal"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Update" />
</LinearLayout>
このレイアウトを使用していくつかのアクティビティを作成したいのですが、各アクティビティで異なる customView を使用したいと考えています。例えば。1 つのアクティビティでは、カスタム ビューを customView1 に、2 番目のアクティビティでは customView2 に、などとします。
どうすればそれを行うことができますか?現在、私はアクティビティごとに個別の XML レイアウトを持っているだけですが、これは非常に冗長に思えます。