As in my title gridview and it is images are not get fit for all screens .
In my app I have 15 images and it is titles ,I wanna show it on a 3 column and 5 row format in all screen sizes.
But my Gridview is not fit for all screen sizes and images,titles are not get properly aligned .
I have tested my app in following API levels and got the below response .
Reminders.java
public class Reminders extends Fragment {
private OnFragmentInteractionListener mListener;
private View rootView;
public Reminders() {
}
public static Reminders newInstance(String param1, String param2) {
Reminders fragment = new Reminders();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState) {
rootView = inflater.inflate(R.layout.fragment_reminders, container, false);
GridView gridView = (GridView) rootView.findViewById(R.id.photogridview);
gridView.setAdapter(new ImageAdapter(rootView.getContext())); // uses the view to get the context instead of getActivity().
return rootView;
}
public void onButtonPressed(Uri uri) {
if (mListener != null) {
mListener.onFragmentInteraction(uri);
}
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof OnFragmentInteractionListener) {
mListener = (OnFragmentInteractionListener) context;
} else {
throw new RuntimeException(context.toString()
+ " must implement OnFragmentInteractionListener");
}
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
public interface OnFragmentInteractionListener {
void onFragmentInteraction(Uri uri);
}
}