【问题标题】:Adjust layout perfectly on all screens在所有屏幕上完美调整布局
【发布时间】:2018-05-19 08:03:52
【问题描述】:

您好,我的应用程序有这个屏幕,但我希望布局完全适合各种屏幕尺寸的手机,而不是滚动视图。如果手机屏幕高度很小,我希望每个布局都相应地降低高度。

底部有边距,我不想要那个多余的空间。

我的 XML 代码是:

    <?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=".DashboardActivity">

<FrameLayout 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"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context=".DashboardActivity"
    tools:showIn="@layout/activity_dashboard">

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:background="@color/colorPrimary"
            android:layout_weight="2">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:paddingTop="150dp"
                android:text="Match Starts in 02:24:39"
                android:textSize="20dp"
                android:textStyle="bold" />

        </LinearLayout>


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_weight="1">
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:weightSum="2"
                android:orientation="horizontal">

                <android.support.v7.widget.CardView
                    android:layout_width="match_parent"
                    android:layout_weight="1"
                    android:layout_height="wrap_content"
                    android:id="@+id/liveMarket"
                    android:elevation="10dp"
                    app:cardCornerRadius="8dp"
                    app:cardBackgroundColor="@color/white">
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="vertical">
                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:src="@drawable/badge_critical_charts"
                            android:layout_gravity="center"
                            android:paddingTop="5dp" />
                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Live Market"
                            android:textSize="14sp"
                            android:textColor="#000"
                            android:id="@+id/live_Market"
                            android:textStyle="bold"
                            android:layout_gravity="center"
                            android:layout_marginBottom="12dp"
                            />
                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <android.support.v7.widget.CardView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:id="@+id/card2"
                    android:elevation="5dp"
                    app:cardBackgroundColor="@color/white"
                    app:cardCornerRadius="8dp"
                    >
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:orientation="vertical">
                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:src="@drawable/bookkeeping"
                            android:layout_gravity="center"
                            android:paddingTop="5dp"

                            />
                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="My Book"
                            android:textSize="14sp"
                            android:textColor="#000"
                            android:id="@+id/MyBook"
                            android:textStyle="bold"
                            android:layout_gravity="center"
                            android:layout_marginBottom="12dp"
                            />
                    </LinearLayout>
                </android.support.v7.widget.CardView>
            </LinearLayout>



            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:weightSum="2"
                android:layout_marginTop="1dp"
                android:orientation="horizontal">

                <android.support.v7.widget.CardView
                    android:layout_width="match_parent"
                    android:layout_weight="1"
                    android:layout_height="wrap_content"
                    android:id="@+id/card3"
                    app:cardBackgroundColor="@color/white"
                    android:elevation="10dp"
                    app:cardCornerRadius="8dp"
                    >
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="vertical">
                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:src="@drawable/charicon_statistics"
                            android:layout_gravity="center"
                            android:paddingTop="5dp"

                            />
                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Win|Loss Stats"
                            android:textSize="14sp"
                            android:id="@+id/win_loss_stats"
                            android:textStyle="bold"
                            android:textColor="#000"
                            android:layout_gravity="center"
                            android:layout_marginBottom="12dp"
                            />
                    </LinearLayout>

                </android.support.v7.widget.CardView>

                <android.support.v7.widget.CardView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:id="@+id/card4"
                    app:cardBackgroundColor="@color/white"
                    android:elevation="5dp"
                    app:cardCornerRadius="8dp"
                    >
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:orientation="vertical">
                        <ImageView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:src="@drawable/calendar_png_picture"
                            android:layout_gravity="center"
                            android:paddingTop="5dp"
                            />
                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Schedule"
                            android:textSize="14sp"
                            android:textColor="#000"
                            android:id="@+id/Schedule"
                            android:textStyle="bold"
                            android:layout_gravity="center"
                            android:layout_marginBottom="12dp"
                            />
                    </LinearLayout>
                </android.support.v7.widget.CardView>
            </LinearLayout><LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:weightSum="2"
            android:layout_marginTop="1dp"
            android:orientation="horizontal">

            <android.support.v7.widget.CardView
                android:layout_width="match_parent"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:id="@+id/card5"
                android:elevation="10dp"
                app:cardBackgroundColor="@color/white"
                app:cardCornerRadius="8dp"
                >
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">
                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:src="@drawable/pie_chart"
                        android:layout_gravity="center"
                        android:paddingTop="5dp"

                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Poll"
                        android:textSize="14sp"
                        android:textColor="#000"
                        android:id="@+id/Poll"
                        android:textStyle="bold"
                        android:layout_gravity="center"
                        android:layout_marginBottom="12dp"
                        />
                </LinearLayout>

            </android.support.v7.widget.CardView>

            <android.support.v7.widget.CardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:id="@+id/card6"
                app:cardBackgroundColor="@color/white"
                android:elevation="5dp"
                app:cardCornerRadius="8dp"
                >
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical">
                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:src="@drawable/results_icon_png_2"
                        android:layout_gravity="center"
                        android:paddingTop="5dp"

                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Recent Result"
                        android:textSize="14sp"
                        android:id="@+id/Recent_Result"
                        android:textColor="#000"
                        android:textStyle="bold"
                        android:layout_gravity="center"
                        android:layout_marginBottom="12dp"
                        />
                </LinearLayout>
            </android.support.v7.widget.CardView>
        </LinearLayout>



        </LinearLayout>

    </LinearLayout>

</FrameLayout>

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

建议我执行此操作的方法或将我指向正确的文档。

【问题讨论】:

    标签: android xml android-layout screen-size


    【解决方案1】:

    试试这个,你应该改变 cardView 的高度以匹配父级,并将 layout_weight 添加到他们的父级,如下面的代码。

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout 
    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"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context=".DashboardActivity"
    tools:showIn="@layout/activity_dashboard"
    android:orientation="vertical">
    <!--<ScrollView-->
        <!--android:layout_width="match_parent"-->
        <!--android:layout_height="match_parent">-->
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:orientation="vertical"
        android:background="@color/colorPrimary"
        android:layout_weight="1"
        android:gravity="bottom">
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="Match Starts in 02:24:39"
            android:textSize="20sp"
            android:textStyle="bold" />
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:orientation="vertical"
        android:layout_weight="1">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:weightSum="2"
            android:layout_weight="1"
            android:orientation="horizontal">
            <android.support.v7.widget.CardView
                android:layout_width="match_parent"
                android:layout_weight="1"
                android:layout_height="match_parent"
                android:id="@+id/liveMarket"
                android:elevation="10dp"
                app:cardCornerRadius="8dp"
                app:cardBackgroundColor="@color/white">
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">
                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:src="@drawable/badge_critical_charts"
                        android:layout_gravity="center"
                        android:paddingTop="5dp" />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Live Market"
                        android:textSize="14sp"
                        android:textColor="#000"
                        android:id="@+id/live_Market"
                        android:textStyle="bold"
                        android:layout_gravity="center"
                        android:layout_marginBottom="12dp"
                        />
                </LinearLayout>
            </android.support.v7.widget.CardView>
            <android.support.v7.widget.CardView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:id="@+id/card2"
                android:elevation="5dp"
                app:cardBackgroundColor="@color/white"
                app:cardCornerRadius="8dp"
                >
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical">
                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:src="@drawable/bookkeeping"
                        android:layout_gravity="center"
                        android:paddingTop="5dp"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="My Book"
                        android:textSize="14sp"
                        android:textColor="#000"
                        android:id="@+id/MyBook"
                        android:textStyle="bold"
                        android:layout_gravity="center"
                        android:layout_marginBottom="12dp"
                        />
                </LinearLayout>
            </android.support.v7.widget.CardView>
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:weightSum="2"
            android:layout_marginTop="1dp"
            android:layout_weight="1"
            android:orientation="horizontal">
            <android.support.v7.widget.CardView
                android:layout_width="match_parent"
                android:layout_weight="1"
                android:layout_height="match_parent"
                android:id="@+id/winLossCard"
                app:cardBackgroundColor="@color/white"
                android:elevation="10dp"
                app:cardCornerRadius="8dp"
                >
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:id="@+id/win_loss_stats">
                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:src="@drawable/charicon_statistics"
                        android:layout_gravity="center"
                        android:paddingTop="5dp"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Win|Loss Stats"
                        android:textSize="14sp"
                        android:textStyle="bold"
                        android:textColor="#000"
                        android:layout_gravity="center"
                        android:layout_marginBottom="12dp"
                        />
                </LinearLayout>
            </android.support.v7.widget.CardView>
            <android.support.v7.widget.CardView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:id="@+id/card4"
                app:cardBackgroundColor="@color/white"
                android:elevation="5dp"
                app:cardCornerRadius="8dp"
                >
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical"
                    android:id="@+id/Schedule">
                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:src="@drawable/calendar_png_picture"
                        android:layout_gravity="center"
                        android:paddingTop="5dp"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Schedule"
                        android:textSize="14sp"
                        android:textColor="#000"
                        android:textStyle="bold"
                        android:layout_gravity="center"
                        android:layout_marginBottom="12dp"
                        />
                </LinearLayout>
            </android.support.v7.widget.CardView>
        </LinearLayout>
        <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:weightSum="2"
        android:layout_marginTop="1dp"
        android:layout_weight="1"
        android:orientation="horizontal">
            <android.support.v7.widget.CardView
                android:layout_width="match_parent"
                android:layout_weight="1"
                android:layout_height="match_parent"
                android:id="@+id/card5"
                android:elevation="10dp"
                app:cardBackgroundColor="@color/white"
                app:cardCornerRadius="8dp"
                >
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">
                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:src="@drawable/pie_chart"
                        android:layout_gravity="center"
                        android:paddingTop="5dp"
                        />
                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Poll"
                        android:textSize="14sp"
                        android:textColor="#000"
                        android:id="@+id/Poll"
                        android:textStyle="bold"
                        android:layout_gravity="center"
                        android:layout_marginBottom="12dp"
                        />
                </LinearLayout>
            </android.support.v7.widget.CardView>
            <android.support.v7.widget.CardView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:id="@+id/card6"
            app:cardBackgroundColor="@color/white"
            android:elevation="5dp"
            app:cardCornerRadius="8dp"
            >
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">
                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/results_icon_png_2"
                    android:layout_gravity="center"
                    android:paddingTop="5dp"
                    />
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Recent Result"
                    android:textSize="14sp"
                    android:id="@+id/Recent_Result"
                    android:textColor="#000"
                    android:textStyle="bold"
                    android:layout_gravity="center"
                    android:layout_marginBottom="12dp"
                    />
            </LinearLayout>
        </android.support.v7.widget.CardView>
        </LinearLayout>
    </LinearLayout>
    <!--</ScrollView>-->
    

    【讨论】:

      【解决方案2】:

      移除了嵌套布局,缩进 xml:

      <?xml version="1.0" encoding="utf-8"?>
      <LinearLayout 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"
          android:orientation="vertical"
          android:weightSum="1"
          tools:context=".DashboardActivity"
          tools:showIn="@layout/activity_dashboard">
      
          <LinearLayout
              android:layout_width="match_parent"
              android:layout_height="0dp"
              android:layout_weight="1"
              android:background="@color/colorPrimary"
              android:orientation="vertical">
      
              <TextView
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:gravity="center"
                  android:paddingTop="150dp"
                  android:text="Match Starts in 02:24:39"
                  android:textSize="20dp"
                  android:textStyle="bold" />
      
          </LinearLayout>
      
          <LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical">
      
              <LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:orientation="horizontal"
                  android:weightSum="2">
      
                  <android.support.v7.widget.CardView
                      android:id="@+id/liveMarket"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_weight="1"
                      android:elevation="10dp"
                      app:cardBackgroundColor="@color/white"
                      app:cardCornerRadius="8dp">
      
                      <LinearLayout
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:orientation="vertical">
      
                          <ImageView
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_gravity="center"
                              android:paddingTop="5dp"
                              android:src="@drawable/badge_critical_charts" />
      
                          <TextView
                              android:id="@+id/live_Market"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_gravity="center"
                              android:layout_marginBottom="12dp"
                              android:text="Live Market"
                              android:textColor="#000"
                              android:textSize="14sp"
                              android:textStyle="bold" />
                      </LinearLayout>
      
                  </android.support.v7.widget.CardView>
      
                  <android.support.v7.widget.CardView
                      android:id="@+id/card2"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_weight="1"
                      android:elevation="5dp"
                      app:cardBackgroundColor="@color/white"
                      app:cardCornerRadius="8dp">
      
                      <LinearLayout
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"
                          android:orientation="vertical">
      
                          <ImageView
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_gravity="center"
                              android:paddingTop="5dp"
                              android:src="@drawable/bookkeeping"
      
                              />
      
                          <TextView
                              android:id="@+id/MyBook"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_gravity="center"
                              android:layout_marginBottom="12dp"
                              android:text="My Book"
                              android:textColor="#000"
                              android:textSize="14sp"
                              android:textStyle="bold" />
                      </LinearLayout>
      
                  </android.support.v7.widget.CardView>
      
              </LinearLayout>
      
              <LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginTop="1dp"
                  android:orientation="horizontal"
                  android:weightSum="2">
      
                  <android.support.v7.widget.CardView
                      android:id="@+id/card3"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_weight="1"
                      android:elevation="10dp"
                      app:cardBackgroundColor="@color/white"
                      app:cardCornerRadius="8dp">
      
                      <LinearLayout
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:orientation="vertical">
      
                          <ImageView
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_gravity="center"
                              android:paddingTop="5dp"
                              android:src="@drawable/charicon_statistics"
      
                              />
      
                          <TextView
                              android:id="@+id/win_loss_stats"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_gravity="center"
                              android:layout_marginBottom="12dp"
                              android:text="Win|Loss Stats"
                              android:textColor="#000"
                              android:textSize="14sp"
                              android:textStyle="bold" />
                      </LinearLayout>
      
                  </android.support.v7.widget.CardView>
      
                  <android.support.v7.widget.CardView
                      android:id="@+id/card4"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_weight="1"
                      android:elevation="5dp"
                      app:cardBackgroundColor="@color/white"
                      app:cardCornerRadius="8dp">
      
                      <LinearLayout
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"
                          android:orientation="vertical">
      
                          <ImageView
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_gravity="center"
                              android:paddingTop="5dp"
                              android:src="@drawable/calendar_png_picture" />
      
                          <TextView
                              android:id="@+id/Schedule"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_gravity="center"
                              android:layout_marginBottom="12dp"
                              android:text="Schedule"
                              android:textColor="#000"
                              android:textSize="14sp"
                              android:textStyle="bold" />
                      </LinearLayout>
      
                  </android.support.v7.widget.CardView>
      
              </LinearLayout>
      
              <LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginTop="1dp"
                  android:orientation="horizontal"
                  android:weightSum="2">
      
                  <android.support.v7.widget.CardView
                      android:id="@+id/card5"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_weight="1"
                      android:elevation="10dp"
                      app:cardBackgroundColor="@color/white"
                      app:cardCornerRadius="8dp">
      
                      <LinearLayout
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:orientation="vertical">
      
                          <ImageView
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_gravity="center"
                              android:paddingTop="5dp"
                              android:src="@drawable/pie_chart"
      
                              />
      
                          <TextView
                              android:id="@+id/Poll"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_gravity="center"
                              android:layout_marginBottom="12dp"
                              android:text="Poll"
                              android:textColor="#000"
                              android:textSize="14sp"
                              android:textStyle="bold" />
                      </LinearLayout>
      
                  </android.support.v7.widget.CardView>
      
                  <android.support.v7.widget.CardView
                      android:id="@+id/card6"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:layout_weight="1"
                      android:elevation="5dp"
                      app:cardBackgroundColor="@color/white"
                      app:cardCornerRadius="8dp">
      
                      <LinearLayout
                          android:layout_width="match_parent"
                          android:layout_height="match_parent"
                          android:orientation="vertical">
      
                          <ImageView
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_gravity="center"
                              android:paddingTop="5dp"
                              android:src="@drawable/results_icon_png_2"
      
                              />
      
                          <TextView
                              android:id="@+id/Recent_Result"
                              android:layout_width="wrap_content"
                              android:layout_height="wrap_content"
                              android:layout_gravity="center"
                              android:layout_marginBottom="12dp"
                              android:text="Recent Result"
                              android:textColor="#000"
                              android:textSize="14sp"
                              android:textStyle="bold" />
                      </LinearLayout>
      
                  </android.support.v7.widget.CardView>
      
              </LinearLayout>
      
          </LinearLayout>
      
      </LinearLayout>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-02-09
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多