Android滚动视图隐藏布局中的顶部内容 [英] Android scrollview hiding top content in layout

查看:29
本文介绍了Android滚动视图隐藏布局中的顶部内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个问题,即 android 滚动视图开始隐藏我在布局顶部的一对文本视图,我在这个网站上找到了另一个人,他遇到了这个问题,但不幸的是,那个帮助我的人得到了帮助他们实际上并没有说修复了什么,谁能告诉我这里修复了什么?

Im having a problem where the android scrollview starts hiding a pair of textviews I have at the top of my layout, I have found another person on this very site who had that problem and was able to get help unfortunately the person who helped them didnt actually say what fixes it, can anyone tell me what was the fix here?

android滚动视图隐藏顶部内容

这里的任何帮助都是巨大的,这是我的 xml 代码:

any help would be huge here is my xml code:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/title_color_dark_transparent" >

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center_vertical|center_horizontal|center"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_gravity="center"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_marginTop="5dp"
        android:orientation="vertical"
        android:paddingTop="5dp" >

        <TextView
            android:id="@+id/saysomething"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/loading"
            android:textColor="#FFFFFF"
            android:textSize="30dp" />

        <TextView
            android:id="@+id/saysomethinginfo"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp"
            android:text="@string/loading"
            android:textColor="#FFFFFF"
            android:textSize="17dp" />

        <EditText
            android:id="@+id/tweetedittext"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/edit_text"
            android:gravity="top"
            android:hint="@string/edittext_hint"
            android:inputType="textCapSentences|textMultiLine|textAutoCorrect|textAutoComplete"
            android:lines="3"
            android:textAppearance="@style/TextAppearance.EditText"
            android:textSize="17dp" />

        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="5dp"
            android:layout_marginTop="5dp"
            android:orientation="horizontal" >

            <Button
                android:id="@+id/photobutton"
                style="@style/TextAppearance.Button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/button_background"
                android:onClick="photobuttonClicked"
                android:text="@string/photobuttontext"
                android:textSize="15dp" />

            <TextView
                android:id="@+id/charactersremaining"
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:layout_centerInParent="true"
                android:layout_toLeftOf="@+id/posttweetbutton"
                android:text="@string/characters"
                android:textColor="#FFFFFF"
                android:textSize="20dp" />

            <Button
                android:id="@id/posttweetbutton"
                style="@style/TextAppearance.Button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_marginLeft="2dp"
                android:background="@drawable/button_background"
                android:onClick="posttweetbuttonClicked"
                android:text="@string/postbuttonstext"
                android:textSize="15dp" />
        </RelativeLayout>
    </LinearLayout>

    <TextView
        android:id="@+id/photodetails"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text=""
        android:textColor="#FFFFFF"
        android:textSize="17dp"
        android:layout_marginTop="8dp"
        android:layout_marginLeft="8dp" />

    <ImageView
        android:id="@+id/iv_pic"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp" />
</LinearLayout>

</ScrollView>

推荐答案

找到了!LinearLayout 中的 android:layout_gravity="center" 才是罪魁祸首.删除它,一切都会好起来的.

Found it ! It's the android:layout_gravity="center" in the LinearLayout that is the culprit. Just delete this and everything should be fine.

这篇关于Android滚动视图隐藏布局中的顶部内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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