android线性布局将两个项目放在一起

android线性布局将两个项目放在一起,第1张

概述我有以下布局: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="match_parent" 我有以下布局:
<linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"xmlns:tools="http://schemas.androID.com/tools"androID:layout_wIDth="match_parent"androID:layout_height="match_parent"androID:paddingBottom="@dimen/activity_vertical_margin"androID:paddingleft="@dimen/activity_horizontal_margin"androID:paddingRight="@dimen/activity_horizontal_margin"androID:paddingtop="@dimen/activity_vertical_margin"androID:orIEntation="vertical"tools:context=".MainActivity" >   <linearLayout            androID:layout_wIDth="match_parent"            androID:layout_height="wrap_content"            androID:orIEntation="horizontal"             ><TextVIEw    androID:ID="@+ID/textVIEw1"    androID:layout_wIDth="wrap_content"    androID:layout_height="wrap_content"    androID:text="Status:"    androID:layout_gravity="left"    androID:textAppearance="?androID:attr/textAppearanceMedium" />  <ImageVIEw                androID:ID="@+ID/txcpluss_imageVIEw_refresh"                androID:layout_wIDth="30dp"                androID:layout_height="30dp"                androID:layout_gravity="right"                androID:clickable="true"                androID:contentDescription="icon"                androID:gravity="right"                androID:src="@drawable/refresh_big" />  </linearLayout> </linearLayout>

但我的刷新图标不在我想要的右上角.它就在文本视图旁边.@H_404_5@

如何让文本视图位于左侧,右侧的刷新图标位于左侧?@H_404_5@解决方法 使用以下代码

<linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"xmlns:tools="http://schemas.androID.com/tools"androID:layout_wIDth="match_parent"androID:layout_height="match_parent"androID:orIEntation="vertical"androID:paddingBottom="@dimen/activity_vertical_margin"androID:paddingleft="@dimen/activity_horizontal_margin"androID:paddingRight="@dimen/activity_horizontal_margin"androID:paddingtop="@dimen/activity_vertical_margin"tools:context=".MainActivity" ><linearLayout    androID:layout_wIDth="match_parent"    androID:layout_height="wrap_content"    androID:orIEntation="horizontal" >    <TextVIEw        androID:ID="@+ID/textVIEw1"        androID:layout_wIDth="0dp"        androID:layout_height="wrap_content"        androID:layout_gravity="left"        androID:layout_weight="1"        androID:text="Status:"        androID:textAppearance="?androID:attr/textAppearanceMedium" />    <ImageVIEw        androID:ID="@+ID/txcpluss_imageVIEw_refresh"        androID:layout_wIDth="30dp"        androID:layout_height="30dp"        androID:layout_gravity="right"        androID:clickable="true"        androID:contentDescription="icon"        androID:gravity="right"        androID:src="@drawable/refresh_big" /></linearLayout>

我为文本视图添加了权重.@H_404_5@ 总结

以上是内存溢出为你收集整理的android线性布局将两个项目放在一起全部内容,希望文章能够帮你解决android线性布局将两个项目放在一起所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

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

原文地址: http://outofmemory.cn/web/1130411.html

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

发表评论

登录后才能评论

评论列表(0条)

保存