展会信息港展会大全

Android开发教程之ScrollView 使用注意事项
来源:互联网   发布日期:2015-10-03 10:52:55   浏览:2288次  

导读:要想达到这样的效果ScrollView xmlns:android=http: schemas android com apk res android android:id=@+id scroller android:layout_width=fill_parent android:layout_height=fill_parent andr ...

要想达到这样的效果

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scroller" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillViewport="true">

<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical">

<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingLeft="6dip" android:paddingRight="6dip" android:paddingTop="6dip" android:textAppearance="?android:attr/textAppearanceMedium" android:text="Welcome to My Application"/>

<View android:layout_width="fill_parent" android:layout_height="1dip" android:background="#ff106510" android:layout_marginLeft="6dip" android:layout_marginRight="6dip" android:layout_marginTop="6dip" android:layout_marginBottom="12dip"/>

<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1.0" android:paddingLeft="6dip" android:paddingRight="6dip" android:paddingBottom="6dip" android:text="@string/hello"/>

<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@android:drawable/bottom_bar" android:gravity="center_vertical">

<Button android:layout_width="0dip" android:layout_weight="1.0" android:layout_height="wrap_content" android:text="Accept"/>

<Button android:layout_width="0dip" android:layout_weight="1.0" android:layout_height="wrap_content" android:text="Refuse"/>

</LinearLayout>

</LinearLayout>

</ScrollView>

android:fillViewport. When set to true, this attribute causes the

scroll view s child to expand to the height of theScrollViewif

needed. When the child is taller than theScrollView, the attribute

has no effect.

set the android:layout_weight of the TextView to 1.0

赞助本站

人工智能实验室

相关热词: ScrollView Android

相关内容
AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港