ListView不滚动Despitie有多个单元格

时间:2015-09-17 18:47:52

标签: android android-listview

我在使result = set() for s in sets: result.symmetric_difference_update(s) 无法滚动时遇到问题。我缺少一些XML吗?

VehicleColorFragment

ListView

fragment_vehicle_color.xml(我的片段布局)

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.fragment_vehicle_color, container, false);
    final VehicleColorAdapter mForecastAdapter = new VehicleColorAdapter(getActivity(), R.layout.vehicle_color_cell , R.id.vehicle_color_textview, new ArrayList<VehicleColor>());

    ListView listView = (ListView) rootView.findViewById(R.id.color_list);
    listView.setAdapter(mForecastAdapter);

    //Todo: Replace with Adams factory
    ArrayList<VehicleColor> arrayOfVehicles = new ArrayList<VehicleColor>();
    VehicleColor newVehicle1 = new VehicleColor("Red", "#F44336");
    VehicleColor newVehicle2 = new VehicleColor("Blue", "#0D47A1");
    VehicleColor newVehicle3 = new VehicleColor("Black", "#000000");
    arrayOfVehicles.add(newVehicle1);
    arrayOfVehicles.add(newVehicle2);
    arrayOfVehicles.add(newVehicle3);

    mForecastAdapter.addAll(arrayOfVehicles);

    return rootView;
}

vehicle_color_cell.xml我的列表视图

<LinearLayout 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:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:weightSum="100"
android:orientation="vertical"
tools:context="com.roadstruck.mobile.fragments.VehicleSelectorFragment"
android:background="?android:attr/colorBackground"
android:id="@+id/fragment_color_selector"
>

<TextView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/choosen_color_cell"
    android:layout_weight="60"
    android:topLeftRadius="30dp"
    android:topRightRadius="30dp"
    android:bottomLeftRadius="30dp"
    android:bottomRightRadius="30dp"
    android:gravity="center"
    />

<LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <ListView
        android:layout_width="wrap_content"
        android:layout_centerInParent="true"
        android:id="@+id/color_list"
        android:columnWidth="90dp"
        android:layout_weight="1"
        android:layout_height="0dip"
        android:gravity="center"
        />
</LinearLayout>
</LinearLayout>

0 个答案:

没有答案