手机屏幕适配

来源:互联网 发布:大淘客cms建站要钱吗 编辑:程序博客网 时间:2024/06/11 10:01

测试:320*480(中兴)--

<ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_below="@id/top"
        android:layout_marginTop="@dimen/margin_max" >


        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" >


            <ImageView
                android:id="@+id/image"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_centerHorizontal="true"
                android:layout_marginBottom="@dimen/margin_max"
                android:layout_marginLeft="@dimen/margin_max"
                android:layout_marginRight="@dimen/margin_max"
                android:background="@drawable/exclamation_mark" />


            <TextView
                android:id="@+id/red_text1"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/image"
                android:layout_marginBottom="@dimen/margin_max"
                android:layout_marginLeft="@dimen/margin_max"
                android:layout_marginRight="@dimen/margin_max"
                android:text="@string/people_else1"
                android:textColor="@color/red"
                android:textSize="@dimen/text_15" />


            <TextView
                android:id="@+id/red_text2"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/red_text1"
                android:layout_marginLeft="@dimen/margin_max"
                android:layout_marginRight="@dimen/margin_max"
                android:text="@string/people_else2"
                android:textColor="@color/string_bgblue_main"
                android:textSize="@dimen/text_15" />
        </RelativeLayout>
    </ScrollView>

显示正常,如果把: android:layout_marginLeft="@dimen/margin_max"
                android:layout_marginRight="@dimen/margin_max"

拿出来放到RelativeLayout标签中就显示居左。

但是在480*800,也就是屏幕宽度在480以上的手机上显示正常。

原创粉丝点击