Android 在图像视图之间提供相等的空间

Android 在图像视图之间提供相等的空间,android,android-layout,android-xml,Android,Android Layout,Android Xml,我正试图在我的应用程序“关于我”屏幕中添加一些社交图片,但我面临着在图片视图之间留出相等空间的问题 我的图像如下所示: 但我想让它们看起来像这样: 我的代码: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/RelativeLayout1" and

我正试图在我的应用程序“关于我”屏幕中添加一些社交图片,但我面临着在图片视图之间留出相等空间的问题

我的图像如下所示:

但我想让它们看起来像这样:

我的代码:

<?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>


设置imageview的layout\u margin属性以提供图像视图之间的空间。

设置imageview的layout\u margin属性以提供图像视图之间的空间。

设置imageview的layout\u margin属性以提供图像视图之间的空间。

设置imageview的layout\u margin属性以提供图像视图之间的空间查看。

在这里,相应地修改代码,了解android:layout\u weight在以下情况下非常有用:

<?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>

现在开始,相应地修改代码,了解
android:layout\u weight
它在以下情况下非常有用:

<?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>

现在开始,相应地修改代码,了解
android:layout\u weight
它在以下情况下非常有用:

<?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>

现在开始,相应地修改代码,了解
android:layout\u weight
它在以下情况下非常有用:

<?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>

在图像视图之间的线性布局中使用
元素以添加相等的空间。可以使用LinearLayouts的“权重”属性指定宽度,以获得所有不同形状因子中的等距图标

例如:

<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" />

        <Space
            android:layout_width="15dp"
            android:layout_height="match_parent"/>
        <!-- Twitter -->

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

</LinearLayout>

在图像视图之间的线性布局中使用
元素以添加相等的空间。可以使用LinearLayouts的“权重”属性指定宽度,以获得所有不同形状因子中的等距图标

例如:

<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" />

        <Space
            android:layout_width="15dp"
            android:layout_height="match_parent"/>
        <!-- Twitter -->

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

</LinearLayout>

在图像视图之间的线性布局中使用
元素以添加相等的空间。可以使用LinearLayouts的“权重”属性指定宽度,以获得所有不同形状因子中的等距图标

例如:

<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" />

        <Space
            android:layout_width="15dp"
            android:layout_height="match_parent"/>
        <!-- Twitter -->

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

</LinearLayout>

在图像视图之间的线性布局中使用
元素以添加相等的空间。可以使用LinearLayouts的“权重”属性指定宽度,以获得所有不同形状因子中的等距图标

例如:

<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" />

        <Space
            android:layout_width="15dp"
            android:layout_height="match_parent"/>
        <!-- Twitter -->

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

</LinearLayout>

试试看


对于每个图像视图。这将使它们的宽度与线性布局的总宽度相等。我不确定这是否会拉伸图像,如果会,您可能需要设置缩放类型。

试试看


对于每个图像视图。这将使它们的宽度与线性布局的总宽度相等。我不确定这是否会拉伸图像,如果会,您可能需要设置缩放类型。

试试看


对于每个图像视图。这将使它们的宽度与线性布局的总宽度相等。我不确定这是否会拉伸图像,如果会,您可能需要设置缩放类型。

试试看



对于每个图像视图。这将使它们的宽度与线性布局的总宽度相等。我不确定这是否会拉伸图像,如果会,您可能需要设置缩放类型。

设置每个图像视图中的左侧边距设置每个图像视图中的左侧边距设置每个图像视图中的左侧边距设置每个图像视图中的左侧边距设置每个图像视图中的左侧边距设置每个图像视图中的左侧边距