Android 如何在对话活动中设置scrollview
我希望我的对话框活动滚动其中的视图。我在里面使用了几个编辑文本。在布局中添加更多项会增加对话框活动的大小。这是我不想要的。下面是我的对话活动的xml文件Android 如何在对话活动中设置scrollview,android,android-activity,dialog,Android,Android Activity,Dialog,我希望我的对话框活动滚动其中的视图。我在里面使用了几个编辑文本。在布局中添加更多项会增加对话框活动的大小。这是我不想要的。下面是我的对话活动的xml文件 <?xml version="1.0" encoding="utf-8"?> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertic
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android" >
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:weightSum="100"
android:background="@drawable/bg_offer_coffee"
android:padding="10dp"
android:scrollbars="vertical"
android:scrollbarAlwaysDrawVerticalTrack="true">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:hint="Enter Name"
android:gravity="center"
android:ems="10"
android:id="@+id/et_name"
android:layout_marginTop="50dp"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="10"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress"
android:ems="10"
android:id="@+id/et_email"
android:hint="Enter Email"
android:gravity="center"
android:layout_gravity="center_horizontal" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="10"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="phone"
android:gravity="center"
android:hint="Enter contact_number"
android:ems="10"
android:id="@+id/et_contact" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="10"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPostalAddress"
android:ems="10"
android:gravity="center"
android:hint="Enter Address"
android:id="@+id/et_address" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="10"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/et_coffee_brand"
android:hint="Enter Coffee Brand"
android:gravity="center"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="10"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/et_num_person1"
android:hint="Enter Num Of Person"
android:gravity="center"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="10"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/et_num_person2"
android:hint="Enter Num Of Person"
android:gravity="center"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="10"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/et_num_person3"
android:hint="Enter Num Of Person"
android:gravity="center"/>
</LinearLayout>
</ScrollView>
</LinearLayout>
请告诉我如何做到这一点,我尝试了许多链接,但没有任何效果。请帮助但你的布局看起来不错。是的,我以前做过,但现在不行