当前位置: 首页 > 新闻动态 > 软件编程

Android代码实现图片和文字上下布局

作者:用户投稿 浏览: 发布日期:2026-01-16
[导读]:在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>

效果图如下

以上代码我没有写注释,相信大家都可以看懂吧,关于以上代码有任何问题欢迎给我留言,我会在第一时间和大家联系的。谢谢大家。

免责声明:转载请注明出处:http://m.jing-feng.com.cn/news/490879.html

扫一扫高效沟通

多一份参考总有益处

免费领取网站策划SEO优化策划方案

请填写下方表单,我们会尽快与您联系
感谢您的咨询,我们会尽快给您回复!