내 응용 프로그램에서는 두 가지 다른 활동에서 RecyclerView
을 사용해야합니다. 기본 레이아웃 (리사이클 러 뷰)이 두 액티비티에서 동일하기 때문에 레이아웃을 확장하려고 생각했지만 가능한지 모릅니다. 와 나는 이런 식으로 뭔가 의미 "레이아웃을 확장하는":이 경우레이아웃을 확장 할 수 있습니까?
을 내 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