android有带箭头的按钮控件吗?

android有带箭头的按钮控件吗?,第1张

没有自带箭头按钮,都是依靠图片。可以做一个箭头图片,然后按钮背景设置为这个图片就行了。

步骤:

1、在drawable下放入箭头图片arrow.png(http://www.jitu5.com/vector/201403/362739.html)

2、按钮设置android:background="@drawable/arrow"

<TextView

android:id="@+id/tv_online_repost_compencate_type"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentRight="true"

android:drawablePadding="10dp"

android:drawableRight="@mipmap/iv_down"

android:text="请选择"

android:textColor="@color/tv_font_color_clickale" />

使用android:drawableRight="@mipmap/iv_down",可以在textView的右边添加图片。

自定义控件和属性实现

通过ImageView 和TextView的组合自定义ImageTextView控件。

步骤:

首先定义一个layout布局实现功能要求

接下来写一个类继承LinearLayout,导入刚刚的布局,并且设置需要的方法,从而使的能在代码中控制这个自定义控件内容的显示。

使用这个自定义控件的layout中加入这控件,只需要在xml中加入即可。

最后在activity中设置该控件,和其他控件差不多。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/11811285.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-18
下一篇 2023-05-18

发表评论

登录后才能评论

评论列表(0条)

保存