Scrollview的高度

时间:2012-08-30 15:52:18

标签: android scrollview

我的布局包含标题,滚动视图中的内容和页脚。页眉和页脚的位置应该是固定的,但是当我启动应用程序时,页脚不可见,我只能滚动到内容的底部,就是这样。我该如何制作它以便我仍然可以向下滚动到内容的底部,但我的页脚总是可见?

<?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:background="#2E2E2E"
    android:orientation="vertical" >

    <FrameLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="50dp"
        android:background="#CC0000"
        android:orientation="horizontal" >
         <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:layout_gravity="center_vertical"
            android:layout_marginLeft="10dp">

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/internet_group_chat" />

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="NG Online"
            android:textStyle="bold"
            android:layout_marginLeft="5dp"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:layout_gravity="center"/>


    </LinearLayout>
    </FrameLayout>
    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="1dp"
        android:background="#990000"
        android:orientation="horizontal" >
        <Button
            android:id="@+id/mBtnNaslovnica"
            style="@style/button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Naslovnica" />

        <Button
            android:id="@+id/mBtnVjesti"
            style="@style/button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Vjesti" />

        <Button
            android:id="@+id/mBtnVideo"
            style="@style/button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Video" />

        <Button
            android:id="@+id/mBtnFoto"
            style="@style/button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="2.33"
            android:text="Fotogalerija" />
    </LinearLayout>
    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">
            <LinearLayout
                xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">
                <LinearLayout
                    xmlns:android="http://schemas.android.com/apk/res/android"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:paddingTop="5dp"
                    android:paddingBottom="5dp"
                    android:background="#000000"
                    android:orientation="vertical">
                    <TextView
                        android:id="@+id/cur_news_title"
                        android:layout_width="300dp"
                        android:layout_height="wrap_content"
                        android:text="Large Text"
                        android:textSize="20dp"
                        android:layout_marginTop="5dp"
                        android:layout_marginLeft="5dp"
                        android:textAppearance="?android:attr/textAppearanceLarge" />  
                </LinearLayout>
                <FrameLayout
                    xmlns:android="http://schemas.android.com/apk/res/android"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical">
                    <ImageView
                        android:id="@+id/cur_news_img"
                        android:scaleType="fitXY"
                        android:layout_width="fill_parent"
                        android:layout_height="200dp"
                        android:src="@drawable/rihanna" />
                    <LinearLayout
                        xmlns:android="http://schemas.android.com/apk/res/android"
                        android:layout_width="fill_parent"
                        android:layout_height="30dp"
                        android:background="#B3000000"
                        android:orientation="vertical">
                        <LinearLayout
                            xmlns:android="http://schemas.android.com/apk/res/android"
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content"
                            android:orientation="horizontal"
                            android:layout_marginTop="2dp" >                    
                            <TextView
                                android:id="@+id/cur_news_atuhor"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginLeft="5dp"
                                android:text="Small Text"
                                android:textAppearance="?android:attr/textAppearanceSmall" />
                            <TextView
                                android:id="@+id/cur_news_time"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginLeft="5dp"
                                android:text="Small Text"
                                android:textAppearance="?android:attr/textAppearanceSmall" />
                        </LinearLayout>
                        <LinearLayout
                            xmlns:android="http://schemas.android.com/apk/res/android"
                            android:layout_width="fill_parent"
                            android:layout_height="1dp"
                            android:background="#CC0000"
                            android:layout_marginTop="7dp" />
                        <LinearLayout
                            xmlns:android="http://schemas.android.com/apk/res/android"
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content">
                            <LinearLayout
                                xmlns:android="http://schemas.android.com/apk/res/android"
                                android:layout_width="fill_parent"
                                android:layout_marginTop="10dp"
                                android:layout_height="1dp"
                                android:background="#CC0000" />
                        </LinearLayout>
                    </LinearLayout>
                </FrameLayout>
            </LinearLayout>
            <LinearLayout
                xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:background="#F5F5F5">
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Više o"
                    android:layout_marginTop="5dp"
                    android:layout_marginLeft="5dp"
                    android:textColor="#333333"
                    android:textStyle="bold"
                    android:textSize="25dp"
                    android:textAppearance="?android:attr/textAppearanceMedium" />
                <LinearLayout
                    xmlns:android="http://schemas.android.com/apk/res/android"
                    android:layout_width="fill_parent"
                    android:layout_marginTop="5dp"
                    android:layout_height="1dp"
                    android:layout_marginLeft="5dp"
                    android:layout_marginRight="5dp"
                    android:background="#333333" />
                <TextView
                    android:id="@+id/textView1"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:layout_marginLeft="5dp"
                    android:text=" dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamcodolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamcodolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamcodolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamcodolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamcodolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamcodolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamcodolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco "
                    android:textColor="#666666"
                    android:textAppearance="?android:attr/textAppearanceSmall" />
            </LinearLayout>
            </LinearLayout>
   </ScrollView> 
            <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">



        <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="2dp"
            android:background="#CC0000" />
        <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="40dp"
            android:background="#4D000000"
            android:orientation="vertical" >
        <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingRight="4dp"
            android:background="#CC0000"
            android:orientation="vertical" >
            <TextView
                android:id="@+id/textView2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="AKTUALNO"
                android:textSize="10dp"
                android:layout_marginLeft="4dp"
                android:textStyle="bold"
                android:textColor="#FFFFFF"
                android:textAppearance="?android:attr/textAppearanceSmall" />
        </LinearLayout>
            <TextView 
            android:id="@+id/scroller"
            android:singleLine="true"
            android:ellipsize="marquee"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:marqueeRepeatLimit ="marquee_forever"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="#FFFFFF"
            android:text="09:50 Lorem ipsum dolor sit amet, consectetur adipisicing elit | 09:59 Lorem ipsum dolor sit amet, consectetur adipisicing elit | 10:10 Lorem ipsum dolor sit amet, consectetur adipisicing elit | 10:20 Lorem ipsum dolor sit amet, consectetur adipisicing elit | 10:34 Lorem ipsum dolor sit amet, consectetur adipisicing elit"
            android:layout_marginLeft="4dp"
            android:layout_marginTop="0dp"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            />

    </LinearLayout>
    </LinearLayout>

</LinearLayout>

2 个答案:

答案 0 :(得分:2)

您应该为ScrollView使用layout_weight,以便它不占用所有剩余空间:

    <ScrollView
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_weight="1">

答案 1 :(得分:-1)

android:layout_weight添加到ScrollView