Question

I have a GridView in which I put a horizontal scroll. When it was all vertical scroll was working perfectly, now I have changed the type of gridview to make it horizontal but you no longer see the items in the gridview. in xml:

  <com.jess.ui.TwoWayGridView
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:id="@+id/dashboard_grid_report"
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:layout_gravity="center"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:background="#E8E8E8"
            app:gravity="center"
            app:horizontalSpacing="0dp"
            app:scrollDirectionLandscape="horizontal"
            app:scrollDirectionPortrait="horizontal"
            app:stretchMode="none"
            app:verticalSpacing="0dp" />

xml of item:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/item_prospect"
     android:layout_width="200dp"
     android:layout_height="200dp"
     android:background="#00BFFF" >

  <TextView
    android:id="@+id/TxtName"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="10dp"
    android:layout_marginTop="10dp"
    android:textColor="@android:color/black" />

 </RelativeLayout>

In file java:

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

    View rootView = inflater.inflate(R.layout.fragment_dashboard,
            container, false);


    TwoWayGridView gridViewReport = (TwoWayGridView) rootView.findViewById(R.id.dashboard_grid_report);


    GridClientAdapter customGridClientAdapter = new GridClientAdapter(getActivity().getApplicationContext(), R.layout.item_client, Costant.listReport);        
    gridViewReport.setAdapter(customGridClientAdapter); 

         //......

       return rootView;
}

when it was a usual gridview and vertical scroll was everything worked, asesso no longer works. Who can explain it to me?

Était-ce utile?

La solution

In xml remove

 app:stretchMode="none"

it works

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top