CardView的使用

以下内容转自:http://blog.csdn.net/kebi007/article/details/52820102

Cardview要引入support.v7兼容包,在nuget中可以进行引入,但编译仍可能出错,如“Download failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r32.zip and put it to the...”,解决方法参见遇到过的异常中的“引入兼容包报错”和android兼容包中的相关内容。

下面是布局文件内容:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#dedede"
    android:padding="10dp">
    <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        card_view:cardBackgroundColor="#00ffff"
        android:id="@+id/card_view">
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="科比詹姆斯JR斯密斯凯里欧文张林杜兰特库里英格拉姆格兰特希尔乔治德拉蒙德汤普森卡戴珊张林张木木易建联阿泰斯特"
            android:gravity=""
            android:textSize="20sp"
            android:padding="10dp"
            android:layout_margin="10dp"
            android:textColor="#ffffff" />
    </android.support.v7.widget.CardView>
    <SeekBar
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/seekBar1" />

</LinearLayout>

以下是程序代码:

    public class MainActivity : Activity, IOnSeekBarChangeListener
    {
        int count = 1;
        private SeekBar seek;
        private CardView cardview;
        public void OnProgressChanged(SeekBar seekBar, int progress, bool fromUser)
        {
            if (fromUser)
            {
                cardview.Radius = progress;
                cardview.CardElevation = progress;
            }
        }
        public void OnStartTrackingTouch(SeekBar seekBar)
        {
            //throw new NotImplementedException(); 表示进度条刚开始拖动触发的操作
        }
        public void OnStopTrackingTouch(SeekBar seekBar)
        {
            //throw new NotImplementedException();  停止拖动的时候触发的事件
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);
            seek = FindViewById<SeekBar>(Resource.Id.seekBar1);
            cardview = FindViewById<CardView>(Resource.Id.card_view);
            seek.SetOnSeekBarChangeListener(this);
        }

    }

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值