Android的布局图像和兼容性 [英] Android Layout with Images and Compatibility

查看:137
本文介绍了Android的布局图像和兼容性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发一个相册的应用程序。我想放置照片在屏幕上,如以下布局:

I develop a photo album app. I would like to place photos on screen like the following layout :

有关为此,我决定在所有的外面放置一个垂直线性布局。然后将RelativeLayouts的每一行。在一行中的每个RelativeLayouts,我把两个相对布局,包含ImageViews。在每一个RelativeLayout的我调整其大小适当DP正如我在上面的图像绘制。

For this purpose, I decided to place a vertical linear layout at outside of all. Then place RelativeLayouts for each row. In each RelativeLayouts in a row, I put two relative layouts to contain the ImageViews. In each RelativeLayout I size them with proper "dp" as I draw at the image above.

我的问题是,它可以在不同的手机有不同的分辨率相同的观点?如果是这样,这将是适当的做法有我上面显示的看法?

My question is, can it be the same view in different phones with different resolutions ? If so, what would be the proper approach to have the view that I show above ?

感谢

推荐答案

试试这个......,其只对1行,但是你得到的是idea..this垂直线性布局里面..

Try this...its only for 1 row, but you get the idea..this is inside vertical linear layout..

<LinearLayout
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

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

    <LinearLayout
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="match_parent"
        android:orientation="vertical"
         >

        <ImageView
            android:id="@+id/imageView2"
            android:layout_width="wrap_content"
            android:layout_height="1dp"
            android:src="@drawable/ic_launcher"
            android:layout_weight="1" 
            android:layout_gravity="center_horizontal"/>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:layout_weight="1" >

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

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

        </LinearLayout>
    </LinearLayout>
</LinearLayout>

这篇关于Android的布局图像和兼容性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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