私のアプリケーションでは、RecyclerView
を2種類のアクティビティで使用する必要があります。 基本レイアウト(リサイクラビュー)が2つのアクティビティで同じであるため、レイアウトを拡張しようとしていましたが、可能かどうかわかりません。これは私のbase_layout.xml
ある場合レイアウトを拡張することはできますか?
:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/recyclerView">
</android.support.v7.widget.RecyclerView>
</RelativeLayout>
私はchild_layout.xml
にこのような何かをしたいと思います:
include "base_layout.xml"
<Button
android:id="@+id/btnAddVehicle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="+"
android:onClick="launchAddVehicleActivity"/>
私はこのような何かを意味し、「レイアウトを拡張する」と したがって、chid_layout.xml
を使用するアクティビティは、RecyclerView
とButton
を内部に持つことになります。
このようなことは可能ですか?
罰金になると思いますちょうど私が欲しいもの、非常にありがとう:) – Clyky