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);//设置图片距离阴影大小
    }
    

    }

  • 相关阅读:
    二分查找算法
    http协议。会话控制cookie、session
    154. Find Minimum in Rotated Sorted Array II
    8. String to Integer (atoi)
    528. Random Pick with Weight
    415. Add Strings
    158. Read N Characters Given Read4 II
    157. Read N Characters Given Read4
    19. Remove Nth Node From End of List
    29. Divide Two Integers
  • 原文地址:https://www.cnblogs.com/sessionjean/p/6227377.html
Copyright © 2011-2022 走看看