Android代码实现图片和文字上下布局
更新时间:2015年11月16日 15:05:42 作者:风起云涌,勿忘本心
在Android开发中经常会需要用到带文字和图片的button,下面来给大家介绍使用radiobutton实现图片和文字上下布局或左右布局。感兴趣的朋友一起学习吧
在Android开发中经常会需要用到带文字和图片的button,下面来给大家介绍使用radiobutton实现图片和文字上下布局或左右布局。代码很简单就不给大家多解释了。
布局文件很简单,用来展示RadioBUtton的使用方法。
<?xml version="." encoding="utf-"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:button="@null" android:drawableTop="@drawable/ic_launcher" android:text="Test Button" /> </RelativeLayout>
效果图如下
以上代码我没有写注释,相信大家都可以看懂吧,关于以上代码有任何问题欢迎给我留言,我会在第一时间和大家联系的。谢谢大家。
相关文章
Android中Fragment相互切换间不被回收的实现方法
这篇文章主要给大家介绍了关于Android中Fragment相互切换间不被回收的实现方法,文中给出了详细的示例代码和注释供大家参考学习,对大家具有一定的参考学习价值,需要的朋友们下面来一起看看吧。2017-08-08一文了解Android ViewModelScope 如何自动取消协程
这篇文章主要介绍了一文了解Android ViewModelScope 如何自动取消协程,文章围绕主题站展开详细的内容介绍,具有一定参考价值,感兴趣的小伙伴可以参考一下2022-07-07Android RecyclerView添加FootView和HeadView
这篇文章主要介绍了Android RecyclerView添加FootView和HeadView的相关资料,具有一定的参考价值,感兴趣的小伙伴们可以参考一下2016-10-10
最新评论