public class Button extends TextView
Button继承于TextView,所以说,button可使用textView的属性
是否可点击
android:enabled=”true”
设计按钮上有图片样式
android:drawableTop="@mipmap/ic_launcher"
android:drawableBottom="@mipmap/ic_launcher"
android:drawableLeft="@mipmap/ic_launcher"
android:drawableRight="@mipmap/ic_launcher"
<Button
android:text="这是一个按钮"
android:drawableTop="@mipmap/ic_launcher"
android:drawableBottom="@mipmap/ic_launcher"
android:drawableLeft="@mipmap/ic_launcher"
android:drawableRight="@mipmap/ic_launcher"
android:enabled="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/button44"/>
设计点击事件
推荐使用butterKinfer
如果是原生的话
mButton=(Button)findViewById(R.id.button44);
mButton.setOnClickListener(this);
tv1=(TextView)findViewById(R.id.tv1);
@Override
public void onClick(View v) {
switch (v.getId()){
case R.id.button44:
tv1.setText("666666666666");
break;
}
}
目前来说就这么多,以后有了补充