底部工具栏有3个图像 [英] Bottom Toolbar with 3 images

查看:151
本文介绍了底部工具栏有3个图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有三个图像的底部布局。我希望他们平等分配。为此,我使用 layout_weight xml属性。但是它们的视觉表现很糟糕。

I have a bottom layout with three images. I want them to be equal distributed. To do this,I use the layout_weight xml property. But the visual representation of them is awful.

图像尺寸为32 * 32。

The images' dimension is 32*32.

这个特定工具栏的布局代码是:

And my layout code for this particular toolbar is:

<?xml version="1.0" encoding="utf-8"?>

 <android.support.v7.widget.Toolbar     
 xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/toolbar_bottom"
xmlns:appo="http://schemas.android.com/apk/res-auto"
android:minHeight="50dp"
android:background="#ffff8c0e"
appo:theme="@style/ToolbarTheme"
android:minWidth="50dp"
android:elevation="10dp"
>
<LinearLayout
    android:id="@+id/toolbarmenucontainer"
    android:layout_width="match_parent"
    android:weightSum="3"
    android:layout_height="match_parent"
    android:orientation="horizontal" >

    <ImageView
        android:layout_width="0dp"
        android:id="@+id/camera_image"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:clickable="true"

        android:scaleType="fitXY"
        android:src="@drawable/camera_icon"
        />

    <ImageView
        android:id="@+id/news_image"
        android:layout_width="0dp"
        android:layout_height="wrap_content"

        android:clickable="true"
        android:scaleType="fitXY"
        android:layout_weight = "1"
        android:src="@drawable/new_icon"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true" />
    <ImageView
        android:id="@+id/facebook_image"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"

        android:clickable="true"
        android:scaleType="fitXY"
        android:src="@drawable/facebooc_image"
       />
</LinearLayout>

如何让它们看起来好?
谢谢,

How can I make them look good? Thanks,

Theo

推荐答案

换行 ImageView 在另一个布局中说 RelativeLayout

wrap ImageView in another layout say RelativeLayout.

即做类似的事情。

<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:appo="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar_bottom"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#ffff8c0e"
    android:elevation="10dp"
    android:minHeight="50dp"
    android:minWidth="50dp"
    appo:theme="@style/ToolbarTheme" >

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/toolbarmenucontainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal"
        android:weightSum="3" >

        <RelativeLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1" >

            <ImageView
                android:id="@+id/camera_image"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:clickable="true"
                android:scaleType="fitXY"
                android:src="@drawable/camera_icon" />
        </RelativeLayout>

        <RelativeLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1" >

            <ImageView
                android:id="@+id/news_image"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_centerInParent="true"
                android:clickable="true"
                android:scaleType="fitXY"
                android:src="@drawable/new_icon" />
        </RelativeLayout>

        <RelativeLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1" >

            <ImageView
                android:id="@+id/facebook_image"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:clickable="true"
                android:scaleType="fitXY"
                android:src="@drawable/facebooc_image" />
        </RelativeLayout>
    </LinearLayout>
</android.support.v7.widget.Toolbar>

希望这会有所帮助。

这篇关于底部工具栏有3个图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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