【发布时间】:2017-07-25 10:53:35
【问题描述】:
我在xml 中定义了一个布局,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/footer_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<!-- add views here -->
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app"/>
</LinearLayout>
我在我的活动中膨胀它,但 RelativeLayout 需要有 TextViews 取决于来自应用程序的数据。我怎么可能扩展它并在其中添加不同的视图?
注意:这与this question 不同,因为我试图弄清楚如何在不使用类的情况下扩展 inner 布局。
【问题讨论】: