给ImageViews之间的平等空间 [英] give equal space between ImageViews

查看:165
本文介绍了给ImageViews之间的平等空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图添加关于我的屏幕在我的应用程序一定的社会形象,但我面对的给予imageviews之间的平等空格的问题。

我的图片看起来是这样的:

但我想使它们看起来是这样的:

我的code:

 <?XML版本=1.0编码=UTF-8&GT?;
<的RelativeLayout的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:ID =@ + ID / RelativeLayout1
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent
    机器人:背景=@绘制/ about_screen>    <的LinearLayout
        机器人:ID =@ + ID / llSocialMediaContainer
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_alignParentBottom =真
        机器人:方向=横向
        机器人:paddingBottom会=@扪/ bottum_padding>        <! - Facebook的 - >        < ImageView的
            机器人:layout_width =@扪/社交
            机器人:layout_height =@扪/社交
            机器人:SRC =@绘制/脸谱/>        <! - 微博 - >        < ImageView的
            机器人:layout_width =@扪/社交
            机器人:layout_height =@扪/社交
            机器人:SRC =@绘制/叽叽喳喳/>        <! - Google+的 - >        < ImageView的
            机器人:layout_width =@扪/社交
            机器人:layout_height =@扪/社交
            机器人:SRC =@绘制/谷歌/>        <! - LinkedIn - >        < ImageView的
            机器人:layout_width =@扪/社交
            机器人:layout_height =@扪/社交
            机器人:SRC =@绘制/ LinkedIn/>        <! - 博客 - >        < ImageView的
            机器人:layout_width =@扪/社交
            机器人:layout_height =@扪/社交
            机器人:SRC =@绘制/博客/&G​​T;        &所述;! - 的Youtube - >        < ImageView的
            机器人:layout_width =@扪/社交
            机器人:layout_height =@扪/社交
            机器人:SRC =@绘制/ YouTube的/>        <! - 电子邮件 - >        < ImageView的
            机器人:layout_width =@扪/社交
            机器人:layout_height =@扪/社交
            机器人:SRC =@绘制/邮件/>
    < / LinearLayout中>< / RelativeLayout的>


解决方案

有你走,修改code.因此,了解的android:layout_weight 它是有用的在这种情况下:

 <?XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:layout_width =match_parent
    机器人:layout_height =WRAP_CONTENT
    机器人:方向=横向>    < ImageView的
        机器人:layout_width =0dp
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_weight =1
        机器人:SRC =@绘制/ ic_launcher/>    < ImageView的
        机器人:layout_width =0dp
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_weight =1
        机器人:SRC =@绘制/ ic_launcher/>    < ImageView的
        机器人:layout_width =0dp
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_weight =1
        机器人:SRC =@绘制/ ic_launcher/>    < ImageView的
        机器人:layout_width =0dp
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_weight =1
        机器人:SRC =@绘制/ ic_launcher/>    < ImageView的
        机器人:layout_width =0dp
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_weight =1
        机器人:SRC =@绘制/ ic_launcher/>< / LinearLayout中>

i am trying to add some social images in my app about me screen but i am facing a problem of giving equal spaces between imageviews.

my images looks like this:

but i want to make them look like this:

my code:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/RelativeLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/about_screen" >

    <LinearLayout
        android:id="@+id/llSocialMediaContainer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:orientation="horizontal"
        android:paddingBottom="@dimen/bottum_padding" >

        <!-- Facebook -->

        <ImageView
            android:layout_width="@dimen/social"
            android:layout_height="@dimen/social"
            android:src="@drawable/facebook" />

        <!-- Twitter -->

        <ImageView
            android:layout_width="@dimen/social"
            android:layout_height="@dimen/social"
            android:src="@drawable/twitter" />

        <!-- Google+ -->

        <ImageView
            android:layout_width="@dimen/social"
            android:layout_height="@dimen/social"
            android:src="@drawable/google" />

        <!-- Linkedin -->

        <ImageView
            android:layout_width="@dimen/social"
            android:layout_height="@dimen/social"
            android:src="@drawable/linkedin" />

        <!-- Blog -->

        <ImageView
            android:layout_width="@dimen/social"
            android:layout_height="@dimen/social"
            android:src="@drawable/blog" />

        <!-- Youtube -->

        <ImageView
            android:layout_width="@dimen/social"
            android:layout_height="@dimen/social"
            android:src="@drawable/youtube" />

        <!-- Email -->

        <ImageView
            android:layout_width="@dimen/social"
            android:layout_height="@dimen/social"
            android:src="@drawable/mail" />
    </LinearLayout>

</RelativeLayout>

解决方案

There you go, modify the code accordingly, learn about android:layout_weight it is usefull in such situations:

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

    <ImageView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:src="@drawable/ic_launcher" />

    <ImageView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:src="@drawable/ic_launcher" />

    <ImageView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:src="@drawable/ic_launcher" />

    <ImageView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:src="@drawable/ic_launcher" />

    <ImageView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:src="@drawable/ic_launcher" />

</LinearLayout>

这篇关于给ImageViews之间的平等空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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