如何让button点一下凹进去效果

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>用css把a链接模拟成button的样子</title>
<style type="text/css">
<!--
*{font-size:12px;}
a.button:link {      
       padding:3px 6px 2px 8px;
       border:2px outset #ffffff;
       cursor:pointer;
       background-color: #d4d0c8;
       text-align:center;
       height:12px;
       text-decoration: none;
       color: #000000;
       display:inline-block;
       clear:both;      
}
a.button:visited {      
       padding:3px 6px 2px 8px;
       border:2px outset #ffffff;
       cursor:pointer;
       background-color: #d4d0c8;
       text-align:center;
       height:12px;
       text-decoration: none;
       color: #000000;
       display:inline-block;
       clear:both;      
}
a.button:hover {      
       padding:3px 6px 2px 8px;
       border:2px outset #ffffff;
    cursor:pointer;
       background-color: #d4d0c8;
       text-align:center;
       height:12px;
       text-decoration: none;
       color: #0000FF;
       display:inline-block;
       clear:both;      
}
a.button:active {      
       padding:3px 6px 2px 8px;
       border:2px inset;
       cursor:pointer;
       background-color: #d4d0c8;
       text-align:center;
       height:12px;
       text-decoration: none;
       color: #999999;
       display:inline-block;
       clear:both;      
}
-->
</style>
</head>
<body>
<a href="http://blog.sqlsky.com" class="button">菩提树下的杨过</a>&nbsp;<a href="#" class="button">链接模拟的按钮</a>&nbsp;<button style="height:21px">真正的按钮</button>
</body>
</html>

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在Android中,Button控件默认的效果是产生一个阴影。这个阴影效果可以在Button的XML文件中通过设置Button的属性来调整。 要修改Button击阴影效果,可以通过在Button的XML文件中设置相关属性来实现。首先,在Button的XML文件中找到Button控件的声明代码。在Button控件的属性中,可以找到“android:elevation”属性,该属性用于设置Button的阴影大小和高度。通过调整这个属性的值,可以改变Button击阴影效果。 此外,还可以使用“android:stateListAnimator”属性来定义Button在不同状态下的动画效果。默认情况下,Button击阴影效果是一个立体的阴影动画。可以通过在XML文件中定义一个新的stateListAnimator,然后将这个新的stateListAnimator属性赋值给Button的“android:stateListAnimator”属性,来改变Button击阴影效果。 例如,可以在Button的XML文件中添加以下代码来改变Button击阴影效果: ``` <Button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click Me" android:elevation="8dp" android:stateListAnimator="@anim/button_anim" /> ``` 其中,android:elevation的值为8dp,这会使Button产生一个较大的阴影效果。并且,通过设置android:stateListAnimator属性为一个自定义动画文件button_anim,来改变Button击时的阴影动画效果。 总之,通过调整Button的android:elevation属性和android:stateListAnimator属性,可以改变Button控件击阴影效果
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值