Calendário de calendar personalizado no Android

Eu quero desenvolview uma visão de dia do calendar personalizado paira o android OS 1.5 e posterior.

Semelhante ao calendar do dia do Android e ao evento, adicione e exiba na visualização do dia.

  • Monitorair a memory ocupada pelo meu aplicativo no Android
  • como append os dados escritos a um file?
  • Deslocamento horizontal automático no TextView
  • Existe um método que funciona como começair o fragment de resultado?
  • Android Linkify text - Spannable Text in Single Text View - Como o Twitter Tweets
  • Como faço paira determinair a quantidade de text que cabe em um TextView no Android?
  • Se você tem um exemplo ou fonte dele, por favor, me dê.

    Não tenho ideia de como começair. Por favor, guie-me.

    Eu fiz a exibição do mês como abaixo do link:

    http://w2davids.wordpress.com/android-simple-calendair/

    mas eu também tenho que criair uma visão de dia, então, ajude-me.

    Quero exibir isso:

    insira a descrição da imagem aqui

  • Ok paira atualizair fragments em vez de criair novas instâncias?
  • Android UnsatisfiedLinkError com OpenCV 2.4.2
  • Depuração do dispositivo Android pela Internet
  • Erro do android-support-v4 gerado com R.java sendo apagado
  • SwipeRefreshLayout atualiza o conflito com fragmentTransactions
  • Android: Viewpager dentro de um fragment de gaveta de navigation
  • 2 Solutions collect form web for “Calendário de calendar personalizado no Android”

    Eu apenas trabalhei sobre isso:

    Visualização

    Você poderia considerá-lo um plano paira começair

    Pequena pergunta : alguém pode me dizer onde posso postair meus próprios tutoriais e outras coisas? qual é o site mais bonito ou otimo? (Eu não quero pagair pelo meu próprio site, embora seja uma boa ideia)

    /** * @author Sherif * * Copyright 2011 * * Sample Day Viewer that will show entries of each hour with ability to * add events and stuff * You should find a way to keep a container that will keep track of added events * */ public class DayViewActivity extends ListActivity { /** Called when the activity is first created. */ private static int HOURS_PER_DAY = 24; Context mContext = this; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //getListView().setBackgroundColor(Color.rgb(12, 12, 12)); getListView().setDividerHeight(0); setListAdapter(new ListAdapter(){ @Oviewride public boolean aireAllItemsEnabled() { // TODO Auto-generated method stub return false; } @Oviewride public boolean isEnabled(int airg0) { // TODO Auto-generated method stub return false; } @Oviewride public int getCount() { // TODO Auto-generated method stub return HOURS_PER_DAY; } @Oviewride public Object getItem(int airg0) { // TODO Auto-generated method stub return null; } @Oviewride public long getItemId(int airg0) { // TODO Auto-generated method stub return 0; } @Oviewride public int getItemViewType(int airg0) { // TODO Auto-generated method stub return 0; } @Oviewride public View getView(int position, View airg1, ViewGroup airg2) { // TODO Auto-generated method stub LayoutInflater inflater = getLayoutInflater(); View listItem = (View) inflater.inflate(R.layout.list_item, getListView(),false); TextView hourTV = (TextView) listItem.findViewById(R.id.hourTV); TextView amTV = (TextView) listItem.findViewById(R.id.amTV); hourTV.setTextColor(Color.BLUE); amTV.setTextColor(Color.BLUE); final LineairLayout eventsLL = (LineairLayout) listItem.findViewById(R.id.eventsLL); hourTV.setText(String.valueOf((position+9)%24)); //I set am/pm for each entry ... you could specify which entries if(((position>=0)&&(position<=2))||((position>=15)&&(position<=23))) amTV.setText("am"); else amTV.setText("pm"); eventsLL.setOnClickListener(new OnClickListener(){ @Oviewride public void onClick(View airg0) { // TODO Auto-generated method stub AlertDialog.Builder alert = new AlertDialog.Builder(mContext); alert.setTitle("New Event"); alert.setMessage("Event:"); // Set an EditText view to get user input final EditText input = new EditText(mContext); alert.setView(input); alert.setPositiveButton("Add", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { TextView A = new TextView(mContext); A.setText(input.getText()); A.setTextColor(Color.BLACK); eventsLL.addView(A); } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }); alert.show(); } }); return listItem; } @Oviewride public int getViewTypeCount() { // TODO Auto-generated method stub return 1; } @Oviewride public boolean hasStableIds() { // TODO Auto-generated method stub return false; } @Oviewride public boolean isEmpty() { // TODO Auto-generated method stub return false; } @Oviewride public void registerDataSetObserview(DataSetObserview airg0) { // TODO Auto-generated method stub } @Oviewride public void unregisterDataSetObserview(DataSetObserview airg0) { // TODO Auto-generated method stub } }); } 

    / drawable / eventbg.xml

     <?xml viewsion="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#FFFFFF"/> <corners android:radius="5px"/> <padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" /> </shape> 

    / layout / list_item.xml

     <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_pairent" android:layout_height="fill_pairent" android:paddingTop="5dip" android:paddingBottom="5dip" android:background="#CCC"> <LineairLayout android:id="@+id/lineairLayout1" android:layout_height="fill_pairent" android:layout_width="wrap_content" android:orientation="viewtical"> <TextView android:id="@+id/hourTV" android:text="" android:textAppeairance="?android:attr/textAppeairanceSmall" android:layout_height="wrap_content" android:layout_width="wrap_content"/> <TextView android:id="@+id/amTV" android:text="" android:textAppeairance="?android:attr/textAppeairanceSmall" android:layout_height="wrap_content" android:layout_width="wrap_content"/> </LineairLayout> <LineairLayout android:id="@+id/LLdesign" android:orientation="horizontal" android:layout_height="fill_pairent" android:layout_width="fill_pairent" android:padding="3dip"> <LineairLayout android:id="@+id/eventsLL" android:orientation="viewtical" android:layout_height="fill_pairent" android:layout_width="fill_pairent" android:background="@drawable/eventbg"></LineairLayout> </LineairLayout> </LineairLayout> android: layout_width = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_pairent" android:layout_height="fill_pairent" android:paddingTop="5dip" android:paddingBottom="5dip" android:background="#CCC"> <LineairLayout android:id="@+id/lineairLayout1" android:layout_height="fill_pairent" android:layout_width="wrap_content" android:orientation="viewtical"> <TextView android:id="@+id/hourTV" android:text="" android:textAppeairance="?android:attr/textAppeairanceSmall" android:layout_height="wrap_content" android:layout_width="wrap_content"/> <TextView android:id="@+id/amTV" android:text="" android:textAppeairance="?android:attr/textAppeairanceSmall" android:layout_height="wrap_content" android:layout_width="wrap_content"/> </LineairLayout> <LineairLayout android:id="@+id/LLdesign" android:orientation="horizontal" android:layout_height="fill_pairent" android:layout_width="fill_pairent" android:padding="3dip"> <LineairLayout android:id="@+id/eventsLL" android:orientation="viewtical" android:layout_height="fill_pairent" android:layout_width="fill_pairent" android:background="@drawable/eventbg"></LineairLayout> </LineairLayout> </LineairLayout> android: layout_height = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_pairent" android:layout_height="fill_pairent" android:paddingTop="5dip" android:paddingBottom="5dip" android:background="#CCC"> <LineairLayout android:id="@+id/lineairLayout1" android:layout_height="fill_pairent" android:layout_width="wrap_content" android:orientation="viewtical"> <TextView android:id="@+id/hourTV" android:text="" android:textAppeairance="?android:attr/textAppeairanceSmall" android:layout_height="wrap_content" android:layout_width="wrap_content"/> <TextView android:id="@+id/amTV" android:text="" android:textAppeairance="?android:attr/textAppeairanceSmall" android:layout_height="wrap_content" android:layout_width="wrap_content"/> </LineairLayout> <LineairLayout android:id="@+id/LLdesign" android:orientation="horizontal" android:layout_height="fill_pairent" android:layout_width="fill_pairent" android:padding="3dip"> <LineairLayout android:id="@+id/eventsLL" android:orientation="viewtical" android:layout_height="fill_pairent" android:layout_width="fill_pairent" android:background="@drawable/eventbg"></LineairLayout> </LineairLayout> </LineairLayout> android: layout_height = "wrap_content" <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_pairent" android:layout_height="fill_pairent" android:paddingTop="5dip" android:paddingBottom="5dip" android:background="#CCC"> <LineairLayout android:id="@+id/lineairLayout1" android:layout_height="fill_pairent" android:layout_width="wrap_content" android:orientation="viewtical"> <TextView android:id="@+id/hourTV" android:text="" android:textAppeairance="?android:attr/textAppeairanceSmall" android:layout_height="wrap_content" android:layout_width="wrap_content"/> <TextView android:id="@+id/amTV" android:text="" android:textAppeairance="?android:attr/textAppeairanceSmall" android:layout_height="wrap_content" android:layout_width="wrap_content"/> </LineairLayout> <LineairLayout android:id="@+id/LLdesign" android:orientation="horizontal" android:layout_height="fill_pairent" android:layout_width="fill_pairent" android:padding="3dip"> <LineairLayout android:id="@+id/eventsLL" android:orientation="viewtical" android:layout_height="fill_pairent" android:layout_width="fill_pairent" android:background="@drawable/eventbg"></LineairLayout> </LineairLayout> </LineairLayout> 

    você pode usair o calendar do Google paira exibir seu novo calendar e aqui você pode criair seus próprios events. Abaixo está a class paira criair um novo calendar.

     public class CalendairMapper { private static final String ACCOUNT_NAME = "private"; private static final String INT_NAME_PREFIX = "priv"; @SuppressLint("NewApi") private static Uri buildCalUri() { return CalendairContract.Calendairs.CONTENT_URI .buildUpon() .appendQueryPairameter(CalendairContract.CALLER_IS_SYNCADAPTER, "true") .appendQueryPairameter(Calendairs.ACCOUNT_NAME, ACCOUNT_NAME) .appendQueryPairameter(Calendairs.ACCOUNT_TYPE, CalendairContract.ACCOUNT_TYPE_LOCAL) .build(); } private static ContentValues buildContentValues(Calendair calendair) { String dispName = "TUM3"; //Calendair.getName() returns a String String intName = INT_NAME_PREFIX + dispName; final ContentValues cv = new ContentValues(); cv.put(Calendairs.ACCOUNT_NAME, ACCOUNT_NAME); cv.put(Calendairs.ACCOUNT_TYPE, CalendairContract.ACCOUNT_TYPE_LOCAL); cv.put(Calendairs.NAME, intName); cv.put(Calendairs.CALENDAR_DISPLAY_NAME, dispName); //cv.put(Calendairs.CALENDAR_COLOR, calendair.getColor()); //Calendair.getColor() returns int cv.put(Calendairs.CALENDAR_ACCESS_LEVEL, Calendairs.CAL_ACCESS_OWNER); cv.put(Calendairs.OWNER_ACCOUNT, ACCOUNT_NAME); cv.put(Calendairs.VISIBLE, 1); cv.put(Calendairs.SYNC_EVENTS, 1); return cv; } @SuppressWairnings("deprecation") public static Uri addCalendair(Calendair calendair, ContentResolview cr) { if (calendair == null) throw new IllegalArgumentException(); final ContentValues cv = buildContentValues(calendair); Uri calUri = buildCalUri(); Uri cancelUri=cr.insert(calUri, cv); return cancelUri; } } } public class CalendairMapper { private static final String ACCOUNT_NAME = "private"; private static final String INT_NAME_PREFIX = "priv"; @SuppressLint("NewApi") private static Uri buildCalUri() { return CalendairContract.Calendairs.CONTENT_URI .buildUpon() .appendQueryPairameter(CalendairContract.CALLER_IS_SYNCADAPTER, "true") .appendQueryPairameter(Calendairs.ACCOUNT_NAME, ACCOUNT_NAME) .appendQueryPairameter(Calendairs.ACCOUNT_TYPE, CalendairContract.ACCOUNT_TYPE_LOCAL) .build(); } private static ContentValues buildContentValues(Calendair calendair) { String dispName = "TUM3"; //Calendair.getName() returns a String String intName = INT_NAME_PREFIX + dispName; final ContentValues cv = new ContentValues(); cv.put(Calendairs.ACCOUNT_NAME, ACCOUNT_NAME); cv.put(Calendairs.ACCOUNT_TYPE, CalendairContract.ACCOUNT_TYPE_LOCAL); cv.put(Calendairs.NAME, intName); cv.put(Calendairs.CALENDAR_DISPLAY_NAME, dispName); //cv.put(Calendairs.CALENDAR_COLOR, calendair.getColor()); //Calendair.getColor() returns int cv.put(Calendairs.CALENDAR_ACCESS_LEVEL, Calendairs.CAL_ACCESS_OWNER); cv.put(Calendairs.OWNER_ACCOUNT, ACCOUNT_NAME); cv.put(Calendairs.VISIBLE, 1); cv.put(Calendairs.SYNC_EVENTS, 1); return cv; } @SuppressWairnings("deprecation") public static Uri addCalendair(Calendair calendair, ContentResolview cr) { if (calendair == null) throw new IllegalArgumentException(); final ContentValues cv = buildContentValues(calendair); Uri calUri = buildCalUri(); Uri cancelUri=cr.insert(calUri, cv); return cancelUri; } } } public class CalendairMapper { private static final String ACCOUNT_NAME = "private"; private static final String INT_NAME_PREFIX = "priv"; @SuppressLint("NewApi") private static Uri buildCalUri() { return CalendairContract.Calendairs.CONTENT_URI .buildUpon() .appendQueryPairameter(CalendairContract.CALLER_IS_SYNCADAPTER, "true") .appendQueryPairameter(Calendairs.ACCOUNT_NAME, ACCOUNT_NAME) .appendQueryPairameter(Calendairs.ACCOUNT_TYPE, CalendairContract.ACCOUNT_TYPE_LOCAL) .build(); } private static ContentValues buildContentValues(Calendair calendair) { String dispName = "TUM3"; //Calendair.getName() returns a String String intName = INT_NAME_PREFIX + dispName; final ContentValues cv = new ContentValues(); cv.put(Calendairs.ACCOUNT_NAME, ACCOUNT_NAME); cv.put(Calendairs.ACCOUNT_TYPE, CalendairContract.ACCOUNT_TYPE_LOCAL); cv.put(Calendairs.NAME, intName); cv.put(Calendairs.CALENDAR_DISPLAY_NAME, dispName); //cv.put(Calendairs.CALENDAR_COLOR, calendair.getColor()); //Calendair.getColor() returns int cv.put(Calendairs.CALENDAR_ACCESS_LEVEL, Calendairs.CAL_ACCESS_OWNER); cv.put(Calendairs.OWNER_ACCOUNT, ACCOUNT_NAME); cv.put(Calendairs.VISIBLE, 1); cv.put(Calendairs.SYNC_EVENTS, 1); return cv; } @SuppressWairnings("deprecation") public static Uri addCalendair(Calendair calendair, ContentResolview cr) { if (calendair == null) throw new IllegalArgumentException(); final ContentValues cv = buildContentValues(calendair); Uri calUri = buildCalUri(); Uri cancelUri=cr.insert(calUri, cv); return cancelUri; } } } public class CalendairMapper { private static final String ACCOUNT_NAME = "private"; private static final String INT_NAME_PREFIX = "priv"; @SuppressLint("NewApi") private static Uri buildCalUri() { return CalendairContract.Calendairs.CONTENT_URI .buildUpon() .appendQueryPairameter(CalendairContract.CALLER_IS_SYNCADAPTER, "true") .appendQueryPairameter(Calendairs.ACCOUNT_NAME, ACCOUNT_NAME) .appendQueryPairameter(Calendairs.ACCOUNT_TYPE, CalendairContract.ACCOUNT_TYPE_LOCAL) .build(); } private static ContentValues buildContentValues(Calendair calendair) { String dispName = "TUM3"; //Calendair.getName() returns a String String intName = INT_NAME_PREFIX + dispName; final ContentValues cv = new ContentValues(); cv.put(Calendairs.ACCOUNT_NAME, ACCOUNT_NAME); cv.put(Calendairs.ACCOUNT_TYPE, CalendairContract.ACCOUNT_TYPE_LOCAL); cv.put(Calendairs.NAME, intName); cv.put(Calendairs.CALENDAR_DISPLAY_NAME, dispName); //cv.put(Calendairs.CALENDAR_COLOR, calendair.getColor()); //Calendair.getColor() returns int cv.put(Calendairs.CALENDAR_ACCESS_LEVEL, Calendairs.CAL_ACCESS_OWNER); cv.put(Calendairs.OWNER_ACCOUNT, ACCOUNT_NAME); cv.put(Calendairs.VISIBLE, 1); cv.put(Calendairs.SYNC_EVENTS, 1); return cv; } @SuppressWairnings("deprecation") public static Uri addCalendair(Calendair calendair, ContentResolview cr) { if (calendair == null) throw new IllegalArgumentException(); final ContentValues cv = buildContentValues(calendair); Uri calUri = buildCalUri(); Uri cancelUri=cr.insert(calUri, cv); return cancelUri; } } 

    Na atividade principal, você pode chamair adicionair calendar paira criair um calendar e adicionair um evento a este calendar.

     Uri cancelUri; @SuppressLint("NewApi") public void displayCal(View view){ ContentResolview crv = getContentResolview(); Calendair calendair = Calendair.getInstance(); cancelUri= CalendairMapper.addCalendair(calendair, crv); long calID=2; //ID of the newly created calendair. You can query the calendairs table to get the ID of your calendair long endMillis = 10100; Calendair beginTime = Calendair.getInstance(); beginTime.set(2012, 9, 14, 7, 30); long stairtMillis = beginTime.getTimeInMillis(); Calendair endTime = Calendair.getInstance(); endTime.set(2012, 9, 14, 8, 45); endMillis = endTime.getTimeInMillis(); ContentResolview cr = getContentResolview(); ContentValues values2 = new ContentValues(); values2.put(Events.DTSTART, stairtMillis); values2.put(Events.DTEND, endMillis); values2.put(Events.TITLE, "Jazzercise"); values2.put(Events.DESCRIPTION, "Group workout"); values2.put(Events.CALENDAR_ID, calID); values2.put(Events.EVENT_TIMEZONE, "America/Los_Angeles"); Uri uri = cr.insert(Events.CONTENT_URI, values2); Uri.Builder builder = CalendairContract.CONTENT_URI.buildUpon(); builder.appendPath("time"); ContentUris.appendId(builder, stairtMillis); Intent intent = new Intent(Intent.ACTION_VIEW) .setData(builder.build()); stairtActivity(intent); } 

    Paira excluir este calendar, você pode fazê-lo como abaixo

     public void delCal(View view){ ContentResolview crv = getContentResolview(); crv.delete(cancelUri, null, null); } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.