zoukankan      html  css  js  c++  java
  • Android(安卓)-------CardView

    1.activity_main.xml

    <android.support.v7.widget.CardView
        android:id="@+id/cardView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        >
    
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="100dp">
    
        <ImageView
            android:layout_width="150dp"
            android:layout_height="match_parent"
            android:layout_margin="5dp"
            android:scaleType="centerCrop"
            android:src="@drawable/sng" />
    
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
    
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="5dp"
                android:text="棒冰行动"
                android:textSize="18sp"
                android:textStyle="bold" />
    
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="5dp"
                android:text="棒冰行动,公益传播设计夏令营" />
        </LinearLayout>
    </LinearLayout>
    </android.support.v7.widget.CardView>
    

    2.MainActivity.class

    package com.example.administrator.myfirst;

    import android.os.Bundle;
    import android.support.v7.app.AppCompatActivity;
    import android.support.v7.widget.CardView;

    public class MainActivity extends AppCompatActivity {

    private CardView cardView;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    
        cardView = (CardView)findViewById(R.id.cardView);
    
        cardView.setRadius(8);//设置图片圆角的半径大小
    
        cardView.setCardElevation(8);//设置阴影部分大小
    
        cardView.setContentPadding(5,5,5,5);//设置图片距离阴影大小
    }
    

    }

  • 相关阅读:
    python3 初识GUI
    UI自动化测试底层原理
    Oracle导入数据无法导出空表的问题
    Oracle导入大数据量(百万以上)dmp文件,报错ora-12592 :包错误
    selenium 不同版本Driver
    selenium3 调用IE Unable to get browser
    记录错误,服务器上运行自动化脚本找不到窗口。
    python3 实现对代码文件中注释的翻译
    python3 通过邮件发送测试报告
    es6数值类型
  • 原文地址:https://www.cnblogs.com/sessionjean/p/6227377.html
Copyright © 2011-2022 走看看