本文介绍了滚动型机器人顶部隐藏内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有使用滚动麻烦。由于一些奇怪的原因,它是隐藏的内容将显示在顶部。我试着给的margin,padding等,但似乎没有任何工作。这是我的布局:

I am having trouble using ScrollView. For some strange reason, it is hiding the content to be displayed on the top. I tried giving margin, padding, etc. but nothing seems to work. This is my layout:

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:orientation="vertical" android:background="@drawable/background">
    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:background="@drawable/titlebar"
        android:id="@+id/titlebar">
        <TextView android:layout_width="fill_parent" android:id="@+id/textView1"
            android:layout_height="fill_parent" android:layout_gravity="center"
            android:gravity="center" android:textColor="@color/white"
            android:textSize="20dip" android:text="Help"></TextView>
    </LinearLayout>
    <ScrollView android:layout_height="wrap_content" android:id="@+id/scrollView1"
        android:layout_width="fill_parent">
        <LinearLayout android:orientation="vertical" android:id="@+id/linearLayout2"
            android:gravity="center" android:layout_width="fill_parent"
            android:layout_gravity="center" android:layout_height="fill_parent"
            android:paddingLeft="10dip" android:paddingRight="5dip">
            <ImageView android:layout_height="wrap_content"
                android:src="@drawable/icon" android:layout_marginTop="10dip"
                android:id="@+id/help_icon" android:layout_width="fill_parent"
                android:layout_marginBottom="15dip"></ImageView>
            <TextView android:layout_height="wrap_content"
                android:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed dapibus venenatis suscipit.\n\nCras lacus sem, cursus a dictum sed, condimentum quis urna. Ut vel metus lorem, quis semper lacus. Suspendisse eu urna massa, a blandit mi. "
                android:id="@+id/help_text" android:layout_width="wrap_content"
                android:textColor="@color/black" android:textSize="15dip"
                android:paddingBottom="10dip"></TextView>
        </LinearLayout>
    </ScrollView>
</LinearLayout>

我的形象是越来越隐藏在顶部标题栏的后面,其底部的只有一小部分是在设备/仿真器可见。它在Eclipse中显示正常。我使用ADT11

My image is getting hidden behind the top titlebar and only a small part of its bottom is visible in the device/emulator. It appears fine in Eclipse. I am using ADT11

在此先感谢!

推荐答案

我想你想是这样的:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:orientation="vertical">
    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:id="@+id/titlebar">
        <TextView android:layout_width="fill_parent" android:id="@+id/textView1"
            android:layout_height="wrap_content" android:layout_gravity="center"
            android:gravity="center" android:textColor="@android:color/white"
            android:textSize="20dip" android:text="Help"></TextView>

                 <ImageView android:layout_height="wrap_content"
                android:src="@drawable/icon" android:layout_marginTop="10dip"
                android:id="@+id/help_icon" android:layout_width="fill_parent"
                android:layout_marginBottom="15dip"></ImageView>
    </LinearLayout>
    <ScrollView android:layout_height="match_parent" android:id="@+id/scrollView1"
        android:layout_width="fill_parent">
        <LinearLayout android:orientation="vertical" android:id="@+id/linearLayout2"
            android:gravity="center" android:layout_width="fill_parent"
             android:layout_height="fill_parent"
            android:paddingLeft="10dip" android:paddingRight="5dip">

            <TextView android:layout_height="wrap_content"
                android:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed dapibus venenatis suscipit.\n\nCras lacus sem, cursus a dictum sed, condimentum quis urna. Ut vel metus lorem, quis semper lacus. Suspendisse eu urna massa, a blandit mi. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed dapibus venenatis suscipit.\n\nCras lacus sem, cursus a dictum sed, condimentum quis urna. Ut vel metus lorem, quis semper lacus. Suspendisse eu urna massa, a blandit mi.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed dapibus venenatis suscipit.\n\nCras lacus sem, cursus a dictum sed, condimentum quis urna. Ut vel metus lorem, quis semper lacus. Suspendisse eu urna massa, a blandit mi.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed dapibus venenatis suscipit.\n\nCras lacus sem, cursus a dictum sed, condimentum quis urna. Ut vel metus lorem, quis semper lacus. Suspendisse eu urna massa, a blandit mi.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed dapibus venenatis suscipit.\n\nCras lacus sem, cursus a dictum sed, condimentum quis urna. Ut vel metus lorem, quis semper lacus. Suspendisse eu urna massa, a blandit mi.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed dapibus venenatis suscipit.\n\nCras lacus sem, cursus a dictum sed, condimentum quis urna. Ut vel metus lorem, quis semper lacus. Suspendisse eu urna massa, a blandit mi."
                android:id="@+id/help_text" android:layout_width="wrap_content"
                android:textColor="@android:color/white" android:textSize="15sp"
                android:paddingBottom="10dip"></TextView>
        </LinearLayout>
    </ScrollView>
</LinearLayout>

这篇关于滚动型机器人顶部隐藏内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 21:18