如何放置在Android的两个图像之间的文本

编程入门 行业动态 更新时间:2024-10-27 06:22:20
本文介绍了如何放置在Android的两个图像之间的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我要创建的布局在那里我有两个图像在左,在中间偏右和文字。

I want to create layout where I have two images at left and at right and text in center.

我曾尝试与相对布局做,但偏偏它是失败。任何人可以给我一个例子吗?

I have tried to do it with relative layout but unfortunetly it was unsuccessfully. Could anybody provide me an example?

推荐答案

你有没有尝试过的东西怎么样?

Have you tried something like?

<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="schemas.android/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <ImageView android:id="@+id/img1" android:layout_width="50dip" android:layout_height="50dip" android:layout_alignParentLeft="true" android:src="@drawable/image1"/> <ImageView android:id="@+id/img2" android:layout_width="50dip" android:layout_height="50dip" android:layout_alignParentRight="true" android:src="@drawable/image2"/> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_toRightOf="@id/img1" android:layout_toLeftOf="@id/img2" android:layout_alignTop="@id/img1" android:text="I'm between!"/> </RelativeLayout>

如果你不需要对你的看法更多的事情,你可以想使用的LinearLayout 来代替,因为它更容易实现。在这种情况下,你就必须用 layout_weight 属性的发挥。

If you don't need more things on your view, you could want to use LinearLayout instead, since it's more easier to implement. In that case, you just have to play with the layout_weight attribute.

更多推荐

如何放置在Android的两个图像之间的文本

本文发布于:2023-10-08 09:59:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1472294.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图像   文本   两个   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!