本帖最後由 tonyh 於 2018-2-3 17:57 編輯
- package org.istak.ch40_cardview;
- import android.graphics.Color;
- import android.support.v7.app.AppCompatActivity;
- import android.os.Bundle;
- import android.support.v7.widget.CardView;
- public class MainActivity extends AppCompatActivity {
- CardView cv2, cv3;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- cv2= (CardView) findViewById(R.id.cardView2);
- cv3= (CardView) findViewById(R.id.cardView3);
- cv2.setCardBackgroundColor(Color.parseColor("#E6FFD0"));
- cv2.setRadius(20);
- cv2.setCardElevation(10);
- cv3.setCardBackgroundColor(Color.parseColor("#D0FFFF"));
- cv3.setRadius(20);
- cv3.setCardElevation(10);
- }
- }
複製代碼 |