Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android中是否有类似引导面板和jumbotron的东西?_Android_User Interface_Android Layout_Android Fragments_Android Xml - Fatal编程技术网

android中是否有类似引导面板和jumbotron的东西?

android中是否有类似引导面板和jumbotron的东西?,android,user-interface,android-layout,android-fragments,android-xml,Android,User Interface,Android Layout,Android Fragments,Android Xml,我对android的布局很新 我正在创建一个android应用程序,它需要一些有前途的布局和用户界面 需要类似于引导'panel-panel-default和jumbotron之类的东西 我的要求在这张图片中清晰可见 我们可以在谷歌playstore应用程序和whatsapp中看到它们。我已经对它进行了相当多的搜索,并尝试使用GridLayout作为背景(但没有阴影,看起来像平面图像),我希望我能在这里得到答案 它们叫什么以及如何使用。请提及代码或提供参考 提前谢谢 我使用了一个定制的可绘制x

我对android的布局很新

我正在创建一个android应用程序,它需要一些有前途的布局和用户界面

需要类似于引导'
panel-panel-default
jumbotron
之类的东西

我的要求在这张图片中清晰可见

我们可以在谷歌playstore应用程序和whatsapp中看到它们。我已经对它进行了相当多的搜索,并尝试使用
GridLayout
作为背景(但没有阴影,看起来像平面图像),我希望我能在这里得到答案

它们叫什么以及如何使用。请提及代码或提供参考


提前谢谢

我使用了一个定制的可绘制xml作为我的布局背景,以提供类似的效果

在可绘图文件夹中创建一个名为card_background.xml的文件:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
    <shape android:shape="rectangle" >
        <solid android:color="@color/background_material_light" />
    </shape>
</item>
<item
    android:bottom="3dp"
    android:left="5dp"
    android:right="5dp"
    android:top="4dp">
    <shape android:shape="rectangle" >
        <corners android:radius="2dp" />
        <solid android:color="@color/card_shadow" />
    </shape>
</item>
<item
    android:bottom="4dp"
    android:left="6dp"
    android:right="6dp"
    android:top="3dp">
    <shape android:shape="rectangle" >
        <corners android:radius="2dp" />

        <solid android:color="@color/card_white" />
    </shape>
</item>
</layer-list>

然后,您需要在values/color.xml文件中定义两种颜色card_shadow和card_white:

<color name="card_white">#ffffffff</color>
<color name="card_shadow">#CABBBBBB</color>
#ffffffff
#卡巴布
之后,您可以将可绘制文件作为布局的背景传入,例如:

<RelativeLayout
android:id="@+id/card_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/card_background">


这应该可以实现您使用
cardwiew
尝试实现的功能

cardwiew
小部件是
v7支持库的一部分。要在项目中使用它,请添加以下依赖项:

dependencies {
    implementation 'com.android.support:cardview-v7:28.0.0'
}
要使用
CardView
,您需要将其添加到布局文件中

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:card_view="http://schemas.android.com/apk/res-auto">

    <!-- A CardView that contains a TextView -->
    <android.support.v7.widget.CardView
        xmlns:card_view="http://schemas.android.com/apk/res-auto"
        android:id="@+id/card_view"
        android:layout_gravity="center"
        android:layout_width="200dp"
        android:layout_height="200dp"
        card_view:cardCornerRadius="4dp">

        <TextView
            android:id="@+id/info_text"
            android:layout_width="match_parent"
            android:layout_height="match_parent" />
    </android.support.v7.widget.CardView>
</LinearLayout>


不,默认情况下它们不可用。你得自己做。如果你对谷歌推出的新材料设计感兴趣,那么这个链接可能会对你有所帮助。您可能也对以下内容感兴趣: