使用include标签实现UI布局重用,出错啦,求教大家!

这个布局文件报错了,请大家看看这样写,对吗?还是说应该再重建一个线性布局,在重建的线性布局里添加

android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_launcher"
>

android:id="@+id/title_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:background="@drawable/ic_launcher"
android:text="back"
android:textColor="#fff"/>

 <TextView
     android:id="@+id/title_text"
     android:layout_width="0dp"
     android:layout_height="wrap_content"
     android:layout_weight="1"
     android:background="@drawable/ic_launcher"
     android:gravity="center"
     android:text="text"
     android:textColor="#fff"
     android:textSize="24sp" />

android:id="@+id/title_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="5dp"
android:background="@drawable/ic_launcher"
android:text="edit"
android:textColor="#fff"/>

你可以用style设置样式,然后在每个textView中调用样式stye

<item name="android:layout_width">match_parent</item> <item name="android:layout_height">wrap_content</item> <item name="android:background">@drawable/ic_launcher</item>
    <TextView
 android:id="@+id/title_text"
    style="@style/textStyle" />

各位,机器人小N正解哈。