添加ScrollView时的Android Studio渲染
我正在使用Android Studio 1.3.2。所以,我在做一个测试应用程序,我有一个LinearLayout组。布局的预览如下所示: 接下来,我在LinearLayout组的上方添加了一个ScrollView组。然后预览仅显示以下内容: 动作栏不见了。手机的框架不见了 但是,如果我将ScrollView组放在主线LayYour组之后,则渲染是确定的 发生了什么事?我错过什么了吗 下面是带有ScrollView的XML布局:添加ScrollView时的Android Studio渲染,android,android-layout,android-studio,Android,Android Layout,Android Studio,我正在使用Android Studio 1.3.2。所以,我在做一个测试应用程序,我有一个LinearLayout组。布局的预览如下所示: 接下来,我在LinearLayout组的上方添加了一个ScrollView组。然后预览仅显示以下内容: 动作栏不见了。手机的框架不见了 但是,如果我将ScrollView组放在主线LayYour组之后,则渲染是确定的 发生了什么事?我错过什么了吗 下面是带有ScrollView的XML布局: <ScrollView xmlns:android="htt
<ScrollView 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"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
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=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:text="Toppijjngs"
android:textAllCaps="true" />
<CheckBox
android:id="@+id/notify_me_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:onClick="hasTopping"
android:paddingLeft="24dp"
android:text="Whipped Cream"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:text="quantity"
android:textAllCaps="true" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="48dp"
android:layout_height="48dp"
android:onClick="decrement"
android:text="-" />
<TextView
android:id="@+id/quantity_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:text="0"
android:textColor="#000000" />
<Button
android:layout_width="48dp"
android:layout_height="48dp"
android:onClick="increment"
android:text="+" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="order summary"
android:textAllCaps="true" />
<TextView
android:id="@+id/order_summary_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="$0.00"
android:textColor="#000000" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:onClick="submitOrder"
android:text="order" />
</LinearLayout>
由于ScrollView的特性,Android Studio会隐藏手机框架和操作栏,以便您可以看到完整的视图,因此如果您的ScrollView大于手机屏幕,则预览会显示整个ScrollView 如果要在预览窗口中临时查看手机边框,可以执行以下操作:
请使用ScrollView发布XML布局。当您在studio环境中将
ScrollView
作为布局的根目录时,只会显示布局预览。在real app中,它可以正常工作fine@pRaNaY谢谢你说得对。手机上的应用程序很好。只是呈现不同。@Tanis.7x,我在原始帖子中添加了XML布局。谢谢你的评论,谢谢你的解释。我现在明白了。