Android的滚动型躲藏在布局上面的内容 [英] Android scrollview hiding top content in layout

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

问题描述

林具有将Android的滚动型开始躲在一对textviews我在我的布局顶部的问题,我发现其他人在这个网站谁了这个问题,并能得到帮助不幸的是谁帮助的人他们didnt居然说什么修复它,谁​​能告诉我什么是修复在这里?

Android的滚动视图隐藏顶级内容

任何帮助将是巨大的,这里是我的xml code:

 < XML版本=1.0编码=UTF-8&GT?;
<滚动型的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
的xmlns:广告=htt​​p://schemas.android.com/apk/lib/com.google.ads
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
机器人:背景=@色/ title_color_dark_transparent>

<的LinearLayout
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =match_parent
    机器人:layout_gravity =center_vertical | center_horizo​​ntal |中心
    机器人:方向=垂直>

    <的LinearLayout
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =FILL_PARENT
        机器人:layout_gravity =中心
        机器人:layout_marginLeft =8DP
        机器人:layout_marginRight =8DP
        机器人:layout_marginTop =5DP
        机器人:方向=垂直
        机器人:paddingTop =5DP>

        <的TextView
            机器人:ID =@ + ID / saysomething
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT
            机器人:文本=@字符串/加载
            机器人:文字颜色=#FFFFFF
            机器人:TEXTSIZE =30dp/>

        <的TextView
            机器人:ID =@ + ID / saysomethinginfo
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT
            机器人:layout_marginBottom =5DP
            机器人:文本=@字符串/加载
            机器人:文字颜色=#FFFFFF
            机器人:TEXTSIZE =17dp/>

        <的EditText
            机器人:ID =@ + ID / tweetedittext
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =WRAP_CONTENT
            机器人:背景=@可绘制/ edit_text
            机器人:重力=顶
            机器人:提示=@字符串/ edittext_hint
            机器人:inputType =textCapSentences | textMultiLine | textAutoCorrect | textAutoComplete
            机器人:行=3
            机器人:textAppearance =@风格/ TextAppearance.EditText
            机器人:TEXTSIZE =17dp/>

        < RelativeLayout的
            机器人:layout_width =FILL_PARENT
            机器人:layout_height =WRAP_CONTENT
            机器人:layout_marginBottom =5DP
            机器人:layout_marginTop =5DP
            机器人:方向=横向>

            <按钮
                机器人:ID =@ + ID / photobutton
                风格=@风格/ TextAppearance.Button
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:背景=@可绘制/ button_background
                机器人:的onClick =photobuttonClicked
                机器人:文本=@字符串/ photobuttontext
                机器人:TEXTSIZE =15dp/>

            <的TextView
                机器人:ID =@ + ID / charactersremaining
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =FILL_PARENT
                机器人:layout_centerInParent =真
                机器人:layout_toLeftOf =@ + ID / posttweetbutton
                机器人:文本=@字符串/字符
                机器人:文字颜色=#FFFFFF
                机器人:TEXTSIZE =20dp/>

            <按钮
                机器人:ID =@ ID / posttweetbutton
                风格=@风格/ TextAppearance.Button
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:layout_alignParentRight =真
                机器人:layout_marginLeft =2DP
                机器人:背景=@可绘制/ button_background
                机器人:的onClick =posttweetbuttonClicked
                机器人:文本=@字符串/ postbuttonstext
                机器人:TEXTSIZE =15dp/>
        < / RelativeLayout的>
    < / LinearLayout中>

    <的TextView
        机器人:ID =@ + ID / photodetails
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:文本=
        机器人:文字颜色=#FFFFFF
        机器人:TEXTSIZE =17dp
        机器人:layout_marginTop =8DP
        机器人:layout_marginLeft =8DP/>

    < ImageView的
        机器人:ID =@ + ID / iv_pic
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_marginLeft =8DP
        机器人:layout_marginRight =8DP/>
< / LinearLayout中>

< /滚动型>
 

解决方案

找到了! 这是安卓layout_gravity =中心的LinearLayout 这是罪魁祸首。只是删除这一点,一切都应该罚款。

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 scrollview hiding top content

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>

解决方案

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天全站免登陆