同一个layout,在三星的galaxy tab p100(7寸,1024x600)显示的内容还是正常的(大小合适)。为什么在现代的H900(8寸,1024x768),内容都显示得很小呢?基本是P100显示的内容大小只有在H900里的一半。

解决方案 »

  1.   

    是不是你布局写的有问题。。
    布局填充满应该不会有这样的问题吧!
    也有可能你里面的图片大小是600的啊那样的话就少了
    在布局里面用 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    估计就不会有你这样的问题了!
      

  2.   

    补充点你用的是px还是dip
    如果要适配多种分辨率的话还建议用dip,根据你的屏幕大小设置比例而不是绝对的像素点
      

  3.   

    对,得用dip不然显示会有误差
      

  4.   

    1, drawable 三个文件夹中 放置不同分辨率的图片 
    2, android:layout_width="fill_parent"
       android:layout_height="fill_parent"
    3, 最好使用dip
      

  5.   

    如上所述,如果某个图片是不分分辨率的,你需要将其制作成 .9.png图上,否则即使显示宽度充满,也会使图片质量拉缩或压缩影响显示效果
      

  6.   

    不是layout_width的问题哦,布局文件如下:<?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="match_parent"
        android:orientation="vertical" 
        android:background="@drawable/activitybg" >    <LinearLayout
            android:id="@+id/linearLayout1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:background="@drawable/toolbarbg_above">        <Button
                android:id="@+id/buttonHome"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/button_home"
                android:layout_gravity="center_vertical"
                android:layout_marginLeft="5dp"
                android:text="" />
            
            <TextView
                android:id="@+id/titelView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                style="@style/textViewStyle.Title"
                android:layout_gravity="center"
                android:layout_weight="1"
                android:gravity="center"
                android:text="test1" />
            
        </LinearLayout>    <LinearLayout
            android:id="@+id/linearLayout2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/toolbarbg_center" >
            
            <TextView
                android:id="@+id/optView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:layout_gravity="center_vertical"
                android:layout_weight="1"
    style="@style/textViewStyle.Title2"
                android:text="test2" />
            
            <ImageView
                android:id="@+id/imageViewProgress"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="10dp"
                android:src="@drawable/processbarbg_01" />
            
        </LinearLayout>
        
        <MyViewGroup
            android:id="@+id/viewGroup"
    android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"></MyViewGroup>
        
        <LinearLayout
            android:id="@+id/linearLayout4"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:orientation="horizontal" >
            
            <Button
                android:id="@+id/prevButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="15dp"
                android:layout_marginBottom="5dp"
                style="@style/buttonStyle"
                android:text="上一步" />        <Button
                android:id="@+id/nextButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="15dp"
                android:layout_marginBottom="5dp"
                style="@style/buttonStyle"
                android:text="下一步" />
            
        </LinearLayout>
       
    </LinearLayout>
    比如里面的工具票背景图片(processbarbg_01),在三星的机子中就是挺OK的,在HY的机子就显得很小,但实际上这两种设备的分辨率相差不大呀
      

  7.   

            <ImageView
                android:id="@+id/imageViewProgress"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="10dp"
                android:src="@drawable/processbarbg_01" />
    这个尺寸不能设成wrap_content,
    你可以找到 processbarbg_01 对应的图片看它是多少像素的,
    假设那图片是 90*75 px 的,
    那么就要把图片的尺寸设为 (90/1.5)*(75/1.5) dp 的就是 60*50 dp
                android:layout_width="60dp"
                android:layout_height="50dp"
      

  8.   

     “比如里面的工具票背景图片(processbarbg_01),在三星的机子中就是挺OK的,在HY的机子就显得很小,但实际上这两种设备的分辨率相差不大”  把图片资源放到 一个drawable 文件夹下 不同设备分辨率不同 从不同资源文件夹下取图片 有些图片会被拉伸
      

  9.   

    两种产品可能设置的分辨率不同,好像在system.prep中有个值是关于分辨率的,那个值越大,分辨率越低,显示的图越大,但模糊;越小,分辨率越高,显示的就小,但很清晰。默认为160.