Android的分辨率需要帮助 [英] android resolution need help

查看:154
本文介绍了Android的分辨率需要帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发android系统中的应用程序。在默认需要相同分辨率(WVGA800)
HVGA QVGA 和所有模拟器,意味着仿真器的大小应该没有关系,现在我这个 xml文件和我需要为该底部标签栏修复大小也是我shold办?现在我面临的问题是..我已经把对的TabBar空间在底部。所以,当我'运行在默认(WVGA800)HVGA此相同的应用程序或QVGA它重叠的标签栏等web视图,它看起来badwhat应该怎么办?我使用了Android 1.6

I am developing an application in android. in need same resolution for Default(WVGA800) HVGA QVGA and all emulator that mean emulator's size should not matter right now i've this xml file and i'll need fix size for the bottom tab bar for that also what shold i do? right now i am facing problem is.. i've to put space for tabbar at the bottom. so,when i'am run this same application in the Default(WVGA800) HVGA or QVGA it overlap the webview on the tab bar so,it looks badwhat should i do? i am using android 1.6

<?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="371dip">
    <!--    <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="33dip"
            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>

这是我的TabBar活动类

this is my tabbar activity class

final TabHost tabHost = (TabHost) getTabHost();
        try {

            //GlobalVariable.Setdownload(0);
            tabHost.addTab(createTab(myclsname.class, "Welcome",
                    "Welcome", R.drawable.tab_icon_events));
            tabHost.addTab(createTab(anotheclsname.class, ".Mp3List", ".Mp3List",
                    R.drawable.tab_icon_pitchforkfm));
            tabHost.addTab(createTab(AboutUs.class, "AboutUs", "AboutUs",
                    R.drawable.tab_icon_home));
            tabHost.addTab(createTab(ExtraInfromation.class, "ExtraInformation", "ExtraInformation",
                    R.drawable.tab_icon_tv));

            tabHost.setCurrentTab(1);
        } catch (Exception e) {
            // TODO: handle exception
        }
        tabHost.getTabWidget().getChildAt(0).getLayoutParams().width = 85;
        tabHost.getTabWidget().getChildAt(0).getLayoutParams().height=57;
        tabHost.getTabWidget().getChildAt(1).getLayoutParams().width = 85;
        tabHost.getTabWidget().getChildAt(2).getLayoutParams().width = 85;
        tabHost.getTabWidget().getChildAt(3).getLayoutParams().width = 85;
tabHost.setOnTabChangedListener(new OnTabChangeListener() {

    bla.. bla.. bla..

    private TabSpec createTab(final Class<?> intentClass, final String tag,
            final String title, final int drawable) 
    {
        final Intent intent = new Intent().setClass(this, intentClass);

        final View tab = LayoutInflater.from(getTabHost().getContext())
                .inflate(R.layout.tab, null);
        ((TextView) tab.findViewById(R.id.tab_text)).setText(title);
        ((ImageView) tab.findViewById(R.id.tab_icon))
                .setImageResource(drawable);

        return getTabHost().newTabSpec(tag).setIndicator(tab)
                .setContent(intent);

    }

我应该怎么做,上述问题将被解决?在此先感谢:Pragna

what should i do so, above problem will be solve? thanks in advance :Pragna

推荐答案

有这里有几个问题:


  • 您不能得到相同的布局在所有不同的屏幕工作。这已被反反复复地在这里,并在 Android开发人员指南。如该链接解释,你必须设置每个屏幕的分辨率组的布局文件夹,并与所要求的尺寸逐一创建布局(至少 RES /布局小 RES /布局正常 RES /布局大)。此外,您可能需要创建一组位图(如果您有任何)每个屏幕密度( RES /绘,华电国际 RES /绘制-MDPI RES /绘-LDPI 至少)。

  • You can't get the same layout to work in all the different screens. This has been repeated over and over here, and in the android dev guide. As explained in that link, you'll have to set up layout folders for each screen resolution group and create layouts for each one of them with the required sizes (at least res/layout-small, res/layout-normal and res/layout-large). Also, you will probably need to create a set of bitmaps (if you have any) for each screen density (res/drawable-hdpi, res/drawable-mdpi and res/drawable-ldpi at least).

如果要修复底部的选项卡,请在回答这个问题:<一href=\"http://stackoverflow.com/questions/3683363/how-to-reduce-the-tab-bar-height-and-display-in-bottom\">How以减少底部标签栏的高度和显示器。

If you want to fix the tab at the bottom, follow the answers to this question: How to reduce the tab bar height and display in bottom.

如果您使用的是 RelativeLayout的代替的LinearLayout ,那么你可以使用的android:layout_above =@ ID /标签来迫使Android的渲染一切上述标签和不重叠他们。

If you use a RelativeLayout instead of a LinearLayout, then you can use android:layout_above="@id/tabs" to force android to render everything above the tabs and not overlapping them.

如果内容比屏幕大,然后再考虑包括您的布局的滚动型

If the content is bigger than the screen, then consider including your layout inside a ScrollView.

不涉及这个问题,但在SO未来的问题非常重要:请尽量避免张贴不相干code。 java的部分有你的问题毫无兴趣。

Not relevant to this question, but very relevant for future questions in SO: please, try to avoid posting irrelevant code. The Java part has no interest in your question.

这篇关于Android的分辨率需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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