您的位置:首页 > 移动开发 > Android开发

android xml中tools include的引入

2015-10-19 09:37 337 查看
include的用法:

<?xmlversion="1.0"encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayoutxmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">

<includelayout="@layout/list_map_parkingarea"/>

</android.support.design.widget.CoordinatorLayout>


tools的引入:

<?xmlversion="1.0"encoding="utf-8"?>

<android.support.v7.widget.RecyclerViewxmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/list_parking_area"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".BaseActivity"
tools:showIn="@layout/activity_parking_area_list"/>


总结:


用<include>可以在xml中引入其他的文件

在xml中用tools:
在container容器中先引入:
xmlns:tools="http://schemas.android.com/tools"
tools:context=".BaseActivity"
tools:showIn="@layout/包含它的布局文件。"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: