开发者

Multiple screen support on Android

开发者 https://www.devze.com 2023-03-13 01:00 出处:网络
From last few days I\'m trying to create an application that can adjust screen according to emulator\'s size change.. I found the solution that uses multiple screen.

From last few days I'm trying to create an application that can adjust screen according to emulator's size change.. I found the solution that uses multiple screen.

but i am not able to do this i've taken help from this but not able to understand how can i setContentView(R.layout.main); ? because when i am pressing .(dot) after R it doesn't show me this below folders..:( i've created 3 folders named layout-large, layout-small and layout-large-land under the res folder in my android application

i've added this into my manifest file..

<supports-screens
          android:largeScreens="true"
          android:normalScreens="true"
          android:smallScreens="true"       
          android:anyDensity="true" />

Multiple screen support on Android

what thing i am missing over here? i am using android 1.6 thanks in advance question is whether i've to provide this main.xml file to default layout folder also? yes then no affect on chage in screen size no then it close my application forcefully i've tried using API level 7 al开发者_StackOverflow社区so but problem remain same this is my xml file

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



<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:id="@+id/rl"
    android:layout_height="360dip">
    <!--
        <WebView android:id="@+id/webviewHelp"
        android:layout_width="fill_parent"
    -->
    <!--        android:layout_height="fill_parent" />-->
    <WebView android:id="@+id/webviewHelp" android:layout_width="fill_parent"
        android:layout_height="fill_parent" />
    <Button android:id="@+id/My_btn"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true" android:gravity="center"
        android:textSize="8px" android:text="Download this mp3 file"
        android:textColor="@color/white" android:layout_width="fill_parent"
        android:layout_height="28dip" android:visibility="invisible" />
    <Button android:id="@+id/My_btn1"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true" android:text="this is button !"
        android:layout_width="0dip" android:layout_height="0dip"
        android:visibility="invisible" />


</RelativeLayout>


Please add some layout xmls in these folders before you type dot after R :) The folders themselves do not generate resource ids, but the xml files in them do.


I'm not sure it's what you meant, but this worked for me: ScalingLinearLayout

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号