【发布时间】:2016-06-08 22:24:25
【问题描述】:
如何在其中插入滚动视图,并且仍然保留我的应用程序上的标题?此外,所有教程似乎都要求您切换到 LinearLayout,而 LinearLayout 让我很难格式化我需要包含在活动中的所有按钮和文本框。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="washingtondeli.groupboxlunchesestimateandordering.CapitolhillActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Capitol Hill Picnic Box Lunch"
android:id="@+id/capitolhilltitle"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
【问题讨论】:
-
似乎是什么问题?只需将您的 TextView 包装在一个滚动视图中。此外,习惯使用 LinearLayouts,因为它们在不同设备上的外观通常比 RelativeLayouts 更加一致。
标签: android xml android-studio android-scrollview