首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在xml文件中创建材料设计布局?

如何在xml文件中创建材料设计布局?
EN

Stack Overflow用户
提问于 2015-09-05 05:41:58
回答 1查看 1.4K关注 0票数 3

我想在像下面的图片这样的材料设计中创建xml,在材料设计中怎样做呢?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-09-05 07:02:14

试试这个密码..。

代码语言:javascript
复制
<android.support.design.widget.CoordinatorLayout xmlns: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:fitsSystemWindows="true">

<android.support.design.widget.AppBarLayout
    android:id="@+id/appBar"
    android:layout_width="match_parent"
    android:layout_height="192dp"
    android:fitsSystemWindows="true"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:contentScrim="?attr/colorPrimary"
        app:expandedTitleMarginBottom="32dp"
        app:expandedTitleMarginEnd="64dp"
        app:expandedTitleMarginStart="48dp"
        app:layout_scrollFlags="scroll|exitUntilCollapsed">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolBar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_collapseMode="pin"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
    </android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>

<android.support.v7.widget.CardView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="20dp"
    android:layout_marginBottom="20dp"
    android:layout_marginRight="20dp"
    android:layout_marginLeft="20dp" />

如果对你有用就告诉我..。把它标记为答案,这样对别人有用.你会得到这样的东西..。我正在使用cardView库和支持设计库,所以不要忘记将下面的行放在您的build.gradle文件中.

代码语言:javascript
复制
    compile 'com.android.support:design:22.2.1'
    compile 'com.android.support:cardview-v7:21.0.0'

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32409893

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档