对齐的ImageView的布局android的权利 [英] Aligning ImageView to right of the layout android

查看:183
本文介绍了对齐的ImageView的布局android的权利的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个布局

 < XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:方向=横向
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =FILL_PARENT
    机器人:后台=#FFFFFF>

    < TextView的机器人:ID =@ + ID /组名
         机器人:以下属性来=50像素
         机器人:TEXTSIZE =16像素
         机器人:后台=#FFFFFF
         机器人:文字颜色=#000000
         机器人:TEXTSTYLE =正常
         机器人:layout_width =WRAP_CONTENT
         机器人:layout_height =50像素/>
     < ImageView的
             机器人:layout_width =match_parent
             机器人:layout_height =WRAP_CONTENT
             机器人:layout_gravity =右
             机器人:layout_marginRight =6DP
             机器人:后台=#FFFFFF
             机器人:SRC =@可绘制/排序/>

< / LinearLayout中>
 

渲染现像发生在第一个图像,但我想呈现像第二图像完全右对齐。任何帮助将是有益的。

期待您的回复。 谢谢。

解决方案

 < XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:方向=横向
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =FILL_PARENT
    机器人:后台=#FFFFFF>

    < TextView的机器人:ID =@ + ID /组名
         机器人:以下属性来=50dp
         机器人:TEXTSIZE =16DP
         机器人:文字颜色=#000000
         机器人:TEXTSTYLE =正常
         机器人:layout_width =FILL_PARENT
         机器人:layout_height =50dp
         机器人:layout_weight =0.9
         机器人:背景=@彩色/黑白/>
     < ImageView的
             机器人:layout_width =WRAP_CONTENT
             机器人:layout_height =WRAP_CONTENT
             机器人:layout_gravity =右
             机器人:后台=#FFFFFF
             机器人:SRC =@可绘制/签
             机器人:layout_weight =0.1/>

< / LinearLayout中>
 

  

试试这个,希望这将有助于。

I have an layout

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#FFFFFF">

    <TextView android:id="@+id/groupname"
         android:paddingLeft="50px"
         android:textSize="16px"
         android:background="#FFFFFF"
         android:textColor="#000000"
         android:textStyle="normal"
         android:layout_width="wrap_content"
         android:layout_height="50px"/>
     <ImageView
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_gravity="right"
             android:layout_marginRight="6dp"
             android:background="#ffffff" 
             android:src="@drawable/sort"/>

</LinearLayout>

Rendering is happening now like in first image but I wanted to render like in second image fully right aligned. any help would be useful.

Looking forward to your reply. thanks.

解决方案

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#FFFFFF">

    <TextView android:id="@+id/groupname"
         android:paddingLeft="50dp"
         android:textSize="16dp"
         android:textColor="#000000"
         android:textStyle="normal"
         android:layout_width="fill_parent"
         android:layout_height="50dp"
         android:layout_weight="0.9"
         android:background="@color/black"/>
     <ImageView
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_gravity="right"
             android:background="#ffffff" 
             android:src="@drawable/checkin"
             android:layout_weight="0.1"/>

</LinearLayout>

Try this, hope this will help.

这篇关于对齐的ImageView的布局android的权利的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆