List of usage examples for android.widget GridView setVelocityScale
public void setVelocityScale(float scale)
From source file:ca.farrelltonsolar.classic.DayLogCalendar.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { theView = inflater.inflate(R.layout.day_log_calendar, container, false); Bundle args = getArguments();/*from w w w . j ava 2 s.co m*/ int monthOffset = args != null ? args.getInt(ARG_MONTH) : 0; month = DateTime.now().minusMonths(monthOffset).withTimeAtStartOfDay().withDayOfMonth(1); adapter = new CalendarAdapter(this.getActivity(), month); GridView gridview = (GridView) theView.findViewById(R.id.gridview); gridview.setAdapter(adapter); gridview.setVelocityScale(5); TextView title = (TextView) theView.findViewById(R.id.title); title.setText(month.toString("MMMM yyyy")); View linearLayout = theView.findViewById(R.id.headerlayout); DateTime days = month; for (int i = 0; i < 7; i++) { int d = ((i + 6) % 7) + 1; days = days.withDayOfWeek(d); TextView aDay = new TextView(theView.getContext()); aDay.setText(DateTimeFormat.forPattern("E").print(days)); aDay.setGravity(Gravity.CENTER); aDay.setTextColor(Color.BLACK); aDay.setLayoutParams(new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT, 1)); ((LinearLayout) linearLayout).addView(aDay); } return theView; }