<ScrollView android:layout_width="match_parent" android:id="@+id/list_forscrollview" android:layout_height="wrap_content"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <android.support.percent.PercentRelativeLayout android:layout_width="match_parent" android:layout_height="@dimen/y35" android:layout_centerVertical="true" android:layout_marginTop="@dimen/y6" android:background="@color/white"> <RadioGroup android:id="@+id/activity_group_radioGroup_light" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:checkedButton="@+id/order_process" android:gravity="center" android:orientation="horizontal" android:paddingBottom="3dp" android:paddingTop="3dp"> <RadioButton android:id="@+id/hand_light_open" style="@style/main_tab_hand_scene" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginRight="@dimen/x8" android:layout_weight="1.0" android:background="@drawable/function_suggesction" android:gravity="center" /> <RadioButton android:id="@+id/hand_light_close" style="@style/main_tab_hand_scene" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginRight="@dimen/x8" android:layout_weight="1.0" android:background="@drawable/xingneng_progrom" android:checked="false" android:gravity="center" /> <RadioButton android:id="@+id/hand_light_change" style="@style/main_tab_hand_scene" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="1.0" android:background="@drawable/others_radio" android:checked="false" android:gravity="center" /> </RadioGroup> </android.support.percent.PercentRelativeLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="@dimen/y8" android:background="@color/white" android:orientation="vertical" android:paddingBottom="@dimen/y3" android:paddingLeft="@dimen/y8" android:paddingTop="@dimen/y3"> <com.massky.sraumsmarthome.view.ClearEditText android:layout_width="fill_parent" android:layout_height="@dimen/y80" android:background="@null" android:gravity="left|top" android:hint="请简要描述你的问题和意见" android:paddingRight="@dimen/y5" android:textSize="16sp"></com.massky.sraumsmarthome.view.ClearEditText> <com.massky.sraumsmarthome.widget.ListViewForScrollView android:id="@+id/noScrollgridview" android:layout_width="@dimen/x290" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_marginBottom="23dp" android:horizontalSpacing="@dimen/y3" android:numColumns="4" android:scrollbars="none" android:verticalSpacing="@dimen/y5"></com.massky.sraumsmarthome.widget.ListViewForScrollView> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/y3" android:background="@color/white" android:orientation="vertical" android:paddingLeft="@dimen/y8" android:paddingRight="@dimen/y8"> <com.massky.sraumsmarthome.view.ClearEditText android:layout_width="fill_parent" android:layout_height="@dimen/y35" android:background="@null" android:gravity="left|center_vertical" android:hint="请输入您的手机号,方便工作人员联系" android:paddingRight="@dimen/y5" android:textSize="16sp"></com.massky.sraumsmarthome.view.ClearEditText> </LinearLayout> <android.support.percent.PercentRelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/y20" android:paddingBottom="@dimen/y15"> <Button android:id="@+id/btn_cancel_wangguan" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:height="@dimen/y30" android:background="@drawable/add_zigbee_device_btn" android:text="提交" android:textColor="@color/white" android:textSize="16sp" app:layout_widthPercent="80%" /> </android.support.percent.PercentRelativeLayout> </LinearLayout>
</ScrollView>
listview需要注意事项:
public class ListViewForScrollView extends GridView { public ListViewForScrollView(Context context) { super(context); } public ListViewForScrollView(Context context, AttributeSet attrs) { super(context, attrs); } public ListViewForScrollView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override /** * 重写该方法,达到使ListView适应ScrollView的效果 */ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); } }