xml Android空布局模板。来源:工具栏和BottomNavigationView(第2部分) - [构建Instagram克隆] https://www.youtube.com/watch?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xml Android空布局模板。来源:工具栏和BottomNavigationView(第2部分) - [构建Instagram克隆] https://www.youtube.com/watch?相关的知识,希望对你有一定的参考价值。

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

</resources>
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_alignParentTop="true"
        >

        <android.support.design.widget.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/drawable_white_grey_border_top">
            
            <android.support.design.widget.TabLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/tabs">

            </android.support.design.widget.TabLayout>
            
        </android.support.design.widget.AppBarLayout>


    </RelativeLayout>

</merge>
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">



        <android.support.v4.view.ViewPager
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/container">

        </android.support.v4.view.ViewPager>



    </RelativeLayout>

</merge>
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_alignParentBottom="true"
        android:background="@color/white">

        <android.support.design.widget.BottomNavigationView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/bottomNavViewBar"
            android:background="@drawable/drawable_white_grey_border_bottom"
            >


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


    </RelativeLayout>

</merge>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="1dp">

    <item
        android:bottom="-1dp"
        android:top="1dp"
        android:right="-1dp"
        android:left="-1dp">

        <shape
            android:shape="rectangle">
            <stroke
                android:width="1dp"
                android:color="@color/grey"/>
            <solid
                android:color="@color/white"/>

        </shape>
    </item>


</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="1dp">

    <item
        android:bottom="1dp"
        android:top="-1dp"
        android:right="-1dp"
        android:left="-1dp">

        <shape
            android:shape="rectangle">
            <stroke
                android:width="1dp"
                android:color="@color/grey"/>
            <solid
                android:color="@color/white"/>

        </shape>
    </item>


</layer-list>
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#3F51B5</color>
    <color name="colorPrimaryDark">#3d658e</color>
    <color name="colorAccent">#FEC163</color>
    <color name="grey">#9199aa</color>
    <color name="white">#eeeef0</color>
</resources>
   <!-- compile 'com.android.support:design:26.1.0' -->

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns: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:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.burak.instagram.HomeActivity">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <!--Top toolbar-->

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/rellayout1">

            <include layout="@layout/layout_top_tabs"/>

        </RelativeLayout>

        <!--Middle Section (Body)-->

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@id/rellayout1"
            android:id="@+id/rellayout2">

            <include layout="@layout/layout_center_viewpager"/>

        </RelativeLayout>

        <!--Bottom Navigation-->

        <include layout="@layout/layout_bottom_navigation"/>


    </RelativeLayout>


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

以上是关于xml Android空布局模板。来源:工具栏和BottomNavigationView(第2部分) - [构建Instagram克隆] https://www.youtube.com/watch?的主要内容,如果未能解决你的问题,请参考以下文章

Android 使用布局作为模板创建多个布局实例

Android Studio 不渲染布局

xml Android 布局的问题。布局与工具栏重叠

xml Android工具栏布局。

布局 xml 文档中的 Android“工具”命名空间

xml [使布局覆盖任务栏]在折叠工具栏布局中,必须添加所有元素:android:fitsSystemWindows =“t