【发布时间】:2014-01-20 06:11:43
【问题描述】:
当我向下滚动并且该标题不在屏幕中时,我想在滚动视图中显示标题文本视图和标题文本。我的意思是它向上滚动。基本上,当我向下滚动时,我想将标题冻结在屏幕顶部,并且标题向上滚动并且由于向上滚动而对用户不可见。这是我的 XML 文件。 我想冻结 id="@+id/freezed_title_text" 时的 TextView id="@+id/title_text" 的 TextView 向上滚动并且在屏幕中不可见。 提前谢谢你....
<TextView
android:id="@+id/freezed_title_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello"
android:textColor="@color/news_detail_text_textcolor"
android:textSize="@dimen/hdpi_news_detail_title_textsize"
android:textStyle="bold"
android:visibility="gone"/>
<ScrollView
android:id="@+id/scroolview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/exp_background"
android:fillViewport="true"
android:layout_below="@+id/freezed_title_text">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="@dimen/news_detail_layout_height" >
<TextView
android:id="@+id/temp_title_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/news_detail_rellayout_marginleft"
android:layout_marginRight="@dimen/news_detail_rellayout_marginright"
android:text=""
android:textColor="@color/news_detail_text_textcolor"
android:textSize="@dimen/hdpi_news_detail_title_textsize"
android:textStyle="bold" />
<RelativeLayout
android:id="@+id/image_parent"
android:layout_width="match_parent"
android:layout_height="@dimen/news_detail_layout_height"
android:layout_below="@+id/temp_title_text"
android:layout_marginTop="@dimen/news_detail_margintop" >
<ImageView
android:id="@+id/largeimage"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/loadrefresh1" />
<LinearLayout
android:id="@+id/like_dislike_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/news_detail_linear_marginbottom"
android:layout_marginRight="@dimen/news_detail_linear_marginright" >
<ImageView
android:id="@+id/like"
android:layout_width="@dimen/news_detail_img_layoutwidth"
android:layout_height="@dimen/news_detail_img_layoutheight"
android:layout_marginRight="@dimen/news_detail_img_layoutmarginright"
android:src="@drawable/like_bigger" />
<ImageView
android:id="@+id/dislike"
android:layout_width="@dimen/news_detail_img_layoutwidth"
android:layout_height="@dimen/news_detail_img_layoutheight"
android:src="@drawable/disklike_bigger" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/relParent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/image_parent"
android:layout_marginLeft="@dimen/news_detail_rellayout_marginleft"
android:layout_marginRight="@dimen/news_detail_rellayout_marginright"
android:layout_marginTop="@dimen/news_detail_rellayout_margintop"
android:orientation="horizontal" >
<ImageView
android:id="@+id/messageButton"
android:layout_width="@dimen/news_detail_img_layoutwidth"
android:layout_height="@dimen/news_detail_img_layoutheight"
android:layout_marginLeft="@dimen/news_detail_img_layoutmarginleft"
android:layout_toLeftOf="@+id/facebookButton"
android:src="@drawable/message_bigger" />
<ImageView
android:id="@+id/facebookButton"
android:layout_width="@dimen/news_detail_img_layoutwidth"
android:layout_height="@dimen/news_detail_img_layoutheight"
android:layout_marginLeft="@dimen/news_detail_img_layoutmarginleft"
android:layout_toLeftOf="@+id/twitterButton"
android:src="@drawable/facebook_bigger" />
<ImageView
android:id="@+id/twitterButton"
android:layout_width="@dimen/news_detail_img_layoutwidth"
android:layout_height="@dimen/news_detail_img_layoutheight"
android:layout_marginLeft="@dimen/news_detail_img_layoutmarginleft"
android:layout_toLeftOf="@+id/linkedinButton"
android:src="@drawable/twiter_bigger" />
<ImageView
android:id="@+id/linkedinButton"
android:layout_width="@dimen/news_detail_img_layoutwidth"
android:layout_height="@dimen/news_detail_img_layoutheight"
android:layout_alignParentRight="true"
android:layout_marginLeft="@dimen/news_detail_img_marginleft"
android:layout_marginRight="@dimen/news_detail_img_marginright"
android:src="@drawable/linkden_bigger" />
</RelativeLayout>
<TextView
android:id="@+id/title_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/relParent"
android:layout_marginLeft="@dimen/news_detail_rellayout_marginleft"
android:layout_marginRight="@dimen/news_detail_rellayout_marginright"
android:textColor="@color/news_detail_text_textcolor"
android:textSize="@dimen/hdpi_news_detail_title_textsize"
android:textStyle="bold" />
<TextView
android:id="@+id/EMPTY"
android:layout_width="match_parent"
android:layout_height="@dimen/news_detail_text_layout_height"
android:layout_below="@+id/title_text"
android:textColor="@color/newsview_text_colro" />
<TextView
android:id="@+id/datailtext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/EMPTY"
android:layout_marginLeft="@dimen/news_detail_text_marginleft"
android:layout_marginRight="@dimen/news_detail_text_marginright"
android:layout_marginTop="@dimen/news_detail_text_margintop"
android:text="@string/detailed_text"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/news_detail_text_textcolor"
android:textSize="@dimen/hdpi_news_detail_text_textsize" />
<LinearLayout
android:id="@+id/line"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/datailtext"
android:background="@color/exp_background"
android:orientation="vertical" >
<View
android:layout_width="250sp"
android:layout_height="2dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10sp"
android:background="@color/exp_background" />
</LinearLayout>
<RelativeLayout
android:id="@+id/keyword_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/line"
android:layout_marginRight="@dimen/news_detail_text_marginright"
android:orientation="horizontal" >
</RelativeLayout>
<LinearLayout
android:id="@+id/line_2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/keyword_layout"
android:layout_marginLeft="@dimen/news_detail_text_marginleft"
android:layout_marginRight="@dimen/news_detail_text_marginright"
android:orientation="horizontal" >
<View
android:id="@+id/l1"
android:layout_width="130sp"
android:layout_height="1dp"
android:layout_gravity="center"
android:layout_marginBottom="10sp"
android:layout_marginTop="10sp"
android:background="#6f6f6f" />
<TextView
android:id="@+id/black_dot"
android:layout_width="11dp"
android:layout_height="11dp"
android:layout_gravity="center"
android:layout_marginLeft="@dimen/news_detail_img_layoutmarginleft"
android:layout_marginRight="@dimen/news_detail_img_layoutmarginleft"
android:background="@drawable/round_dot"
android:textColor="@color/newsview_text_colro" />
<View
android:id="@+id/l2"
android:layout_width="130sp"
android:layout_height="1dp"
android:layout_gravity="center"
android:layout_marginBottom="10sp"
android:layout_marginRight="0dp"
android:layout_marginTop="10sp"
android:background="#6f6f6f" />
</LinearLayout>
<TextView
android:id="@+id/txt_related_news"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/line_2"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/news_detail_text_marginleft"
android:layout_marginRight="@dimen/news_detail_text_marginright"
android:background="#1f1f21"
android:gravity="center"
android:paddingBottom="3dp"
android:paddingTop="3dp"
android:text="Related News"
android:textColor="#d1d1d3"
android:textSize="18sp" />
<LinearLayout
android:id="@+id/related_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/txt_related_news"
android:layout_marginLeft="@dimen/news_detail_text_marginleft"
android:layout_marginRight="@dimen/news_detail_text_marginright"
android:layout_marginTop="2dp"
android:orientation="vertical" >
</LinearLayout>
<TextView
android:id="@+id/urlTextBottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/related_container"
android:layout_marginLeft="@dimen/news_detail_text_marginleft"
android:layout_marginRight="@dimen/news_detail_text_marginright"
android:layout_marginTop="10sp"
android:lines="2"
android:text="asvcagvcgavscjhasjahvjvsachv"
android:textColor="@color/news_detail_text_textcolor"
android:textColorLink="@color/news_detail_text_textcolor"
android:textSize="@dimen/hdpi_news_detail_text_textsize" />
</RelativeLayout>
</ScrollView>
【问题讨论】:
-
添加您想要实现的图像以及您当前的代码是什么?在这里发布
-
现在XML代码和Desire Output Image也附上了所以请帮我解决我的问题
标签: android scrollview freeze