사용자 지정 gridView를 만들어야합니다. 평일
GridView weekdays = (GridView) linearLayout.findViewById(R.id.weekdays);
weekdays.setAdapter(new Weekdays());
public class WeekDays extends BaseAdapter {
String[] weekdays = null;
public WeekDayAdapter() {
DateFormatSymbols dateFormatSymbols= new DateFormatSymbols();
weekdays = = dateFormatSymbols.getShortWeekdays();
}
public int getCount() {
return 7;
}
public Object getItem(int position) {
return weekdays[position];
}
public long getItemId(int position) {
return GridView.INVALID_ROW_ID;
}
public View getView(int position, View convertView, ViewGroup parent) {
View view = null;
view = new LinearLayout(parent.getContext());
view.setLayoutParams(new GridView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
view.setOrientation(Horizontal);
LinearLayout linearLayout = new LinearLayout(parent.getContext());
linearLayout.setOrientation(Vertical);
TextView weekDays = new TextView(parent.getContext());
weekDays.setText(weekdays[position + 1]);
linearLayout.addView(weekDays);
view.addView(linearLayout);
return view;
}
}
당신은 수를 표시하기위한 일
<GridView
android:id="@+id/weekdays"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:clickable="false"
android:numColumns="7" />
layout.xml 평일에 대한
<GridView
android:id="@+id/days"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:numColumns="7" />
자바 코드를
이
레이아웃 : 그것은 다음과 같이 보일 수 있습니다 이 달의 날짜를 설정하는 것과 비슷한 일을하십시오. 언제든지 질문하십시오.
대답이 있습니까? –
아니, 나는이 질문이 필사적이라고 생각한다. –