English 中文(简体)
XML的内容是什么?
原标题:what is root layout in XML?
  • 时间:2012-07-12 10:38:24
  •  标签:
  • android
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/rootLayout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

    <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="wrap_content"
        android:layout_height="80dp"
        android:scrollbars="none"
        android:layout_x="0dp"
        android:layout_y="0dp"
        android:fillViewport="true" >

        <LinearLayout
            android:id="@+id/linearLayout1"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >


    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_x="0dp"
        android:layout_y="0dp"
        android:src="@drawable/background" />
        </LinearLayout>

    </ScrollView>


    </LinearLayout>

这是我的xml文件,很简单。 我的用意是提高高射率,逐步展现形象(这符合滚动观点)。 这样,我怎么能够这样做,什么是根本的,什么是把根 root从我的法典中说呢?

final Timer timer = new Timer();
        timer.scheduleAtFixedRate(new TimerTask() {
            public void run() {

                runOnUiThread(new Runnable()
                {
                    public void run() {

                        secondCounter++;
                        yourNewHeight += 10;

                        sv.getLayoutParams().height = yourNewHeight;

                        LinearLayout root = (LinearLayout)      findViewById(R.id.rootLayout);
                        root.invalidate();
                        Log.v("", "" +sv.getLayoutParams().height);

                        if(secondCounter == 20){
                            timer.cancel();
                        }
                    }
                });
            }
        }, delay, period);

this is my code in java file.But its not working . guys can you help me out..!!!

问题回答

这一布局的根基是<代码>AbsoluteLayout。

你可以参考这一根基:<代码>。 http://www.un.org/Depts/DGACM/index_russian.htm

mRootView = ((ViewGroup)findViewById(R.id.rootLayout));

请注意,<代码>Absolute Laoyut 长期以来已作解释,你可能希望用替代的<代码>ViewGroup加以替换,例如LinearLayout,RelativeLayout等,视您的其他布局和您如何做事而定。

如果你在法典中适当删除了你的XML(参见:setContentView()。 使用:

AbsoluteLayout root = (AbsoluteLayout) findViewById(R.id.rootLayout);

虽然你只是试图提高<代码>ScrollView的高度,但更有必要直接呼吁:

ScrollView scroll = (ScrollView) findViewById(R.id.scrollView1);

And as above, you should probably use a RelativeLayout or LinearLayout rather than an AbsoluteLayout.

履历 观点只能有一名儿童。 视自己为你的根本内容,直线解剖是它直接和唯一的儿童,在这个过程中,我可以提出你想要的任何意见。

And Absolute 粗略化,我建议不要使用。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签