【发布时间】:2012-04-12 13:33:45
【问题描述】:
我遇到了一个问题,android 滚动视图开始隐藏我在布局顶部的一对文本视图,我在这个网站上找到了另一个人,他遇到了这个问题,不幸的是,帮助的人能够得到帮助他们实际上并没有说什么修复它,谁能告诉我这里的修复是什么?
android scrollview hiding top content
任何帮助都会很大,这是我的 xml 代码:
<?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>
【问题讨论】:
-
我看不到您的 ScrollView 上方的任何 TextView。您还缺少 ScrollView 上的结束标记。
-
似乎我错误地没有在滚动视图的结束标记中发表评论,但它现在在那里,文本视图是您在线性布局内看到的第一个,将文本视图放在线性布局之外给我一个错误,因为显然您在滚动视图中不能有多个孩子
-
我以为你不想让你的 ScrollView 隐藏那些 TextView?也许你应该解释一下你真正想要的布局是什么样的,因为我不是很清楚。
-
布局对于屏幕来说太大了,所以我把它放在一个滚动视图中,但是当我在图像视图中设置图像时,2个文本视图“@+id/saysomething”和“@+id/ saysomethinginfo”是隐藏的,不能滚动查看它说什么,我需要的是让用户能够向上滚动并能够看到隐藏在下面的内容
标签: android android-layout android-xml android-scrollview