使用滚动视图时,必须使用MeasureSpec.EXACTLY测量DrawerLayout

时间:2016-04-29 06:06:34

标签: android listview android-navigation-drawer

我收到此错误<?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillViewport="true" > <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="wrap_content" android:layout_height="match_parent"> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:layout_margin="10dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <LinearLayout android:id="@+id/lin_1" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <ImageView android:id="@+id/iv_professonal_detail_info" android:tag="image_tag" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" /> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="2" android:layout_gravity="center" android:orientation="vertical"> <TextView android:id="@+id/tv_name_detail_info" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge"/> <TextView android:id="@+id/tv_designation_detail_info" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium"/> <TextView android:id="@+id/tv_experience_detail_info" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium"/> </LinearLayout> </LinearLayout> <TextView android:layout_marginTop="10dp" android:text="Specialization: " android:layout_width="match_parent" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" /> <ListView android:id="@+id/list_specialization" android:layout_width="match_parent" android:layout_height="wrap_content" /> <TextView android:layout_marginTop="10dp" android:text="Education:" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" /> <ListView android:id="@+id/list_education" android:layout_width="match_parent" android:layout_height="wrap_content" /> <TextView android:layout_marginTop="10dp" android:text="Experiences:" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" /> <ListView android:id="@+id/list_experience" android:layout_width="match_parent" android:layout_height="wrap_content" /> <android.support.v7.widget.RecyclerView android:id="@+id/my_recycler_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:scrollbars="horizontal" /> </LinearLayout> <TextView android:layout_marginTop="10dp" android:id="@+id/tv_link" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="View User Feedback" android:textStyle="bold" android:clickable="true"/> </LinearLayout> </LinearLayout> </FrameLayout> <!-- The navigation drawer --> <ListView android:id="@+id/left_drawer" android:layout_width="260dp" android:layout_height="match_parent" android:layout_gravity="start" android:choiceMode="singleChoice" android:divider="#e5e5e5" android:dividerHeight="1dp" android:background="@android:color/black" /> </android.support.v4.widget.DrawerLayout> </ScrollView>

我需要问为什么我需要在使用滚动视图时给出特定的宽度和高度?  这是我的xml:

NSString *date = @"2011-02-27T08:06:07.531Z";
NSDateFormatter *dFormat = [[NSDateFormatter alloc] init];

[dFormat setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZ"];

NSDate *dReceive = [dFormat dateFromString:dateString];

[dFormat setDateFormat:@"yyyy-MM-ddTHH:mm:ss.Z"];

NSString *dateReq = [dateFormatter stringFromDate:dReceive];

我实际上需要一个滚动视图。它的工作,如果我给出一个特定的宽度和高度,但我不想使用它,因为它可能会随手机尺寸而变化。请帮忙

0 个答案:

没有答案