Java Code Examples for android.view.ViewGroup
The following code examples are extracted from open source projects. You can click to
vote up the examples that are useful to you.
Example 1
From project 2Degrees-Toolbox, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/.
Source file: ActionMenuPresenter.java

private View findViewForItem(MenuItem item){ final ViewGroup parent=(ViewGroup)mMenuView; if (parent == null) return null; final int count=parent.getChildCount(); for (int i=0; i < count; i++) { final View child=parent.getChildAt(i); if (child instanceof MenuView.ItemView && ((MenuView.ItemView)child).getItemData() == item) { return child; } } return null; }
Example 2
From project 2Degrees-Toolbox, under directory /ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/.
Source file: BaseMenuPresenter.java

/** * Add an item view at the given index. * @param itemView View to add * @param childIndex Index within the parent to insert at */ protected void addItemView(View itemView,int childIndex){ final ViewGroup currentParent=(ViewGroup)itemView.getParent(); if (currentParent != null) { currentParent.removeView(itemView); } ((ViewGroup)mMenuView).addView(itemView,childIndex); }
Example 3
From project 4308Cirrus, under directory /Extras/actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/.
Source file: ActionMenuPresenter.java

private View findViewForItem(MenuItem item){ final ViewGroup parent=(ViewGroup)mMenuView; if (parent == null) return null; final int count=parent.getChildCount(); for (int i=0; i < count; i++) { final View child=parent.getChildAt(i); if (child instanceof MenuView.ItemView && ((MenuView.ItemView)child).getItemData() == item) { return child; } } return null; }
Example 4
From project 4308Cirrus, under directory /Extras/actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/.
Source file: BaseMenuPresenter.java

/** * Add an item view at the given index. * @param itemView View to add * @param childIndex Index within the parent to insert at */ protected void addItemView(View itemView,int childIndex){ final ViewGroup currentParent=(ViewGroup)itemView.getParent(); if (currentParent != null) { currentParent.removeView(itemView); } ((ViewGroup)mMenuView).addView(itemView,childIndex); }
Example 5
From project ActionBarCompat, under directory /ActionBarCompat/src/sk/m217/actionbarcompat/.
Source file: ActionBarHelperBase.java

/** * See {@link android.app.ActionBar#setBackgroundDrawable(Drawable)}. * @throws IllegalStateException If action bar is not initialized. */ public void setBackgroundDrawable(Drawable d){ if (!mInitialized) { throw new IllegalStateException("ActionBar has not been initialized."); } final ViewGroup actionBarCompat=getActionBarCompat(); if (actionBarCompat != null) { actionBarCompat.setBackgroundDrawable(d); } }
Example 6
From project ActionBarCompat, under directory /ActionBarCompat/src/sk/m217/actionbarcompat/.
Source file: ActionBarHelperBase.java

/** * {@inheritDoc} */ @Override public void onSaveInstanceState(Bundle outState){ if (mExpandedMenuPresenter != null && mExpandedMenuPresenter.mCurrentExpandedItem != null) { outState.putInt(KEY_EXPANDED_ITEM,mExpandedMenuPresenter.mCurrentExpandedItem.getItemId()); } final ViewGroup actionBarCompat=getActionBarCompat(); if (actionBarCompat != null) { SparseArray<Parcelable> stateArray=new SparseArray<Parcelable>(); actionBarCompat.saveHierarchyState(stateArray); outState.putSparseParcelableArray(KEY_HIERARCHY_STATE,stateArray); } }
Example 7
From project ActionBarSherlock, under directory /library/src/com/actionbarsherlock/internal/view/menu/.
Source file: ActionMenuPresenter.java

private View findViewForItem(MenuItem item){ final ViewGroup parent=(ViewGroup)mMenuView; if (parent == null) return null; final int count=parent.getChildCount(); for (int i=0; i < count; i++) { final View child=parent.getChildAt(i); if (child instanceof MenuView.ItemView && ((MenuView.ItemView)child).getItemData() == item) { return child; } } return null; }
Example 8
From project ActionBarSherlock, under directory /library/src/com/actionbarsherlock/internal/view/menu/.
Source file: BaseMenuPresenter.java

/** * Add an item view at the given index. * @param itemView View to add * @param childIndex Index within the parent to insert at */ protected void addItemView(View itemView,int childIndex){ final ViewGroup currentParent=(ViewGroup)itemView.getParent(); if (currentParent != null) { currentParent.removeView(itemView); } ((ViewGroup)mMenuView).addView(itemView,childIndex); }
Example 9
From project agit, under directory /agit/src/main/java/com/madgag/android/notifications/.
Source file: NotificationViewSearcher.java

public void search(){ LinearLayout viewParent=new LinearLayout(context); ViewGroup eventView=(ViewGroup)notification.contentView.apply(context,viewParent); search(eventView); viewParent.removeAllViews(); }
Example 10
From project Amantech, under directory /Android/action_bar_sherlock/src/com/actionbarsherlock/internal/view/menu/.
Source file: ActionMenuPresenter.java

private View findViewForItem(MenuItem item){ final ViewGroup parent=(ViewGroup)mMenuView; if (parent == null) return null; final int count=parent.getChildCount(); for (int i=0; i < count; i++) { final View child=parent.getChildAt(i); if (child instanceof MenuView.ItemView && ((MenuView.ItemView)child).getItemData() == item) { return child; } } return null; }
Example 11
From project Amantech, under directory /Android/action_bar_sherlock/src/com/actionbarsherlock/internal/view/menu/.
Source file: BaseMenuPresenter.java

/** * Add an item view at the given index. * @param itemView View to add * @param childIndex Index within the parent to insert at */ protected void addItemView(View itemView,int childIndex){ final ViewGroup currentParent=(ViewGroup)itemView.getParent(); if (currentParent != null) { currentParent.removeView(itemView); } ((ViewGroup)mMenuView).addView(itemView,childIndex); }
Example 12
From project agit, under directory /agit/src/main/java/com/handmark/pulltorefresh/library/support/.
Source file: PullToRefreshListLoadingFragment.java

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){ View layout=super.onCreateView(inflater,container,savedInstanceState); ListView lv=(ListView)layout.findViewById(android.R.id.list); ViewGroup parent=(ViewGroup)lv.getParent(); for (int i=0, z=parent.getChildCount(); i < z; i++) { View child=parent.getChildAt(i); if (child == lv) { parent.removeViewAt(i); mPullToRefreshListView=new PullToRefreshListView(getActivity()); parent.addView(mPullToRefreshListView,i,lv.getLayoutParams()); break; } } return layout; }
Example 13
From project Absolute-Android-RSS, under directory /src/com/AA/Activities/.
Source file: AASettings.java

/** * Creates and returns the current view in the list */ @Override public View getView(int position,View convertView,ViewGroup parent){ LayoutInflater inflater=AASettings.this.getLayoutInflater(); SharedPreferences settings=AASettings.this.settings; View row; if (convertView == null) row=inflater.inflate(R.layout.color_row,null); else row=convertView; TextView tv_colorType=(TextView)row.findViewById(R.id.tv_colorType); ImageView iv_colorDisplay=(ImageView)row.findViewById(R.id.iv_colorDiplay); DisplayTypes[] displayTypes=DisplayTypes.values(); ColorDrawable color=new ColorDrawable(settings.getInt(displayTypes[position].toString(),getDefaultColor(position))); iv_colorDisplay.setBackgroundResource(R.drawable.topbar); iv_colorDisplay.setImageDrawable(color); tv_colorType.setText(this.getItem(position)); return row; }
Example 14
From project actionbar, under directory /actionbar-library/src/main/java/com/github/erd/actionbar/widget/.
Source file: Actionbar.java

/** * {@inheritDoc} */ @Override protected void onFinishInflate(){ super.onFinishInflate(); root=(ViewGroup)findViewById(R.id.action_bar_root); if (root == null) { throw new RuntimeException("Could not find content area!"); } logo=(ActionbarLogo)findViewById(R.id.action_bar_logo); if (logo == null) { throw new RuntimeException("Could not find action bar logo!"); } text=(ActionbarTitle)findViewById(R.id.action_bar_title); if (text == null) { throw new RuntimeException("Could not find action bar title!"); } if (back != null) { root.setBackgroundDrawable(back); } if (type == TYPE_DASHBOARD) { root.removeView(findViewById(R.id.action_bar_hdiv)); root.removeView(findViewById(R.id.action_bar_button_home)); if (draw != null) { logo.setImageDrawable(draw); logo.setVisibility(View.VISIBLE); } else if (data != null) { text.setText(data); } } else if (type == TYPE_STANDARD) { home=(ActionbarButton)findViewById(R.id.action_bar_button_home); home.setOnClickListener(home_click); text.setText(data); } }
Example 15
From project adg-android, under directory /src/com/analysedesgeeks/android/.
Source file: InfoAdapter.java

@Override public View getView(final int position,final View convertView,final ViewGroup parent){ ViewHolder holder; View view=convertView; if (view == null) { view=inflater.inflate(R.layout.widget_info_item,null); holder=new ViewHolder(); holder.icon=(ImageView)view.findViewById(R.id.icon); holder.text=(TextView)view.findViewById(R.id.text); view.setTag(holder); } else { holder=(ViewHolder)view.getTag(); } final InfoItem item=getItem(position); holder.icon.setImageResource(item.iconRes); holder.text.setText(resources.getString(item.textRes)); return view; }
Example 16
From project adg-android, under directory /src/com/analysedesgeeks/android/.
Source file: RssFeedAdapter.java

@Override public View getView(final int position,final View convertView,final ViewGroup parent){ ViewHolder holder; View view=convertView; if (view == null) { view=inflater.inflate(R.layout.widget_rss_item,null); holder=new ViewHolder(); holder.title=(TextView)view.findViewById(R.id.title); holder.date=(TextView)view.findViewById(R.id.date); view.setTag(holder); } else { holder=(ViewHolder)view.getTag(); } final FeedItem rssItem=getItem(position); if (rssItem != null) { holder.title.setText(rssItem.title); String formattedDate=rssItem.formattedDate; if (formattedDate == null) { if (rssItem.date != null) { rssItem.formattedDate=DateUtils.Formatter.FULL_DATE_FORMATTER.format(rssItem.date); } else { rssItem.formattedDate=""; } formattedDate=rssItem.formattedDate; } holder.date.setText(formattedDate); } return view; }
Example 17
From project AirCastingAndroidClient, under directory /src/main/java/pl/llp/aircasting/activity/.
Source file: AboutActivity.java

@Override public View getChildView(int groupPosition,int childPosition,boolean isLastChild,View convertView,ViewGroup parent){ if (convertView == null) { convertView=layoutInflater.inflate(R.layout.about_content,null); } String text=contents[groupPosition]; Spanned spanned=Html.fromHtml(text); spanned=stripUnderlines(spanned); TextView view=(TextView)convertView.findViewById(R.id.content); view.setText(spanned); view.setMovementMethod(LinkMovementMethod.getInstance()); return convertView; }
Example 18
From project AirCastingAndroidClient, under directory /src/main/java/pl/llp/aircasting/activity/adapter/.
Source file: SessionAdapter.java

@Override public View getView(int position,View convertView,ViewGroup parent){ View view=super.getView(position,convertView,parent); Session session=sessions.get(position); Drawable background=evenOddBackground(position); view.setBackgroundDrawable(background); fillTitle(view,context,session); fillStats(view,session); fillTypes(view,session); return view; }
Example 19
public View createContentView(View view){ FrameLayout root=new FrameLayout(this); root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT)); LinearLayout pframe=new LinearLayout(this); pframe.setId(R.id.INTERNAL_PROGRESS_CONTAINER_ID); pframe.setOrientation(LinearLayout.VERTICAL); pframe.setGravity(Gravity.CENTER); ProgressBar progress=new ProgressBar(this,null,android.R.attr.progressBarStyleLarge); pframe.addView(progress,new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT)); root.addView(pframe,new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT)); FrameLayout lframe=new FrameLayout(this); lframe.setId(R.id.INTERNAL_FRAGMENT_CONTAINER_ID); lframe.setVisibility(View.GONE); lframe.addView(view,new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT)); root.addView(lframe,new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT)); return root; }
Example 20
From project Airports, under directory /src/com/nadmm/airports/aeronav/.
Source file: DtppActivity.java

@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){ View view=inflater.inflate(R.layout.dtpp_detail_view,container,false); Button btnDownload=(Button)view.findViewById(R.id.btnDownload); btnDownload.setOnClickListener(new OnClickListener(){ @Override public void onClick( View v){ getAptCharts(); } } ); Button btnDelete=(Button)view.findViewById(R.id.btnDelete); btnDelete.setOnClickListener(new OnClickListener(){ @Override public void onClick( View v){ checkDelete(); } } ); return view; }
Example 21
From project aksunai, under directory /src/org/androidnerds/app/aksunai/.
Source file: Aksunai.java

public View getView(int pos,View convertView,ViewGroup parent){ ViewHolder holder; if (convertView == null) { LayoutInflater inflate=(LayoutInflater)mCtx.getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView=inflate.inflate(R.layout.server_row,parent,false); holder=new ViewHolder(); holder.title=(TextView)convertView.findViewById(R.id.server_title); holder.url=(TextView)convertView.findViewById(R.id.server_address); convertView.setTag(holder); } else { holder=(ViewHolder)convertView.getTag(); } holder.title.setText(mTitles.elementAt(pos)); holder.url.setText(mAddresses.elementAt(pos)); return convertView; }
Example 22
From project aksunai, under directory /src/org/androidnerds/app/aksunai/ui/.
Source file: ChatActivity.java

public void run(){ synchronized (mManager.mConnections) { for ( Server s : mManager.mConnections.values()) { ChatView chat; if (getChatView(s.mName,s.mName) == null) { chat=new ChatView(ChatActivity.this,s.mName,s.mName); chat.setOnTouchListener(gestureListener); if (AppConstants.DEBUG) Log.d(AppConstants.CHAT_TAG,"Create ChatView for Server: " + s.mName); mFlipper.addView(chat); } synchronized (s.mMessageLists) { for ( MessageList mlist : s.mMessageLists.values()) { if (getChatView(s.mName,mlist.mName) == null) { if (AppConstants.DEBUG) Log.d(AppConstants.CHAT_TAG,"Create ChatView for MessageList: " + mlist); chat=new ChatView(ChatActivity.this,s.mName,mlist.mName); chat.setOnTouchListener(gestureListener); mFlipper.addView(chat,0,new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,ViewGroup.LayoutParams.FILL_PARENT)); mFlipper.setDisplayedChild(0); } } } } } }
Example 23
From project AlarmApp-Android, under directory /src/org/alarmapp/activities/adapters/.
Source file: AlarmedUserAdapter.java

@Override public View getView(AlarmedUser item,View row,ViewGroup parent){ TextView tvName=(TextView)row.findViewById(R.id.tvTitle); ImageView ivStatus=(ImageView)row.findViewById(R.id.ivStatus); tvName.setText(item.getFullName()); ivStatus.setImageLevel(item.getAlarmState().getId()); return (row); }
Example 24
From project AlarmApp-Android, under directory /src/org/alarmapp/activities/adapters/.
Source file: AlarmGroupsSpinnerAdapter.java

@Override public View getDropDownView(int position,View convertView,ViewGroup parent){ View row=super.getView(position,convertView,parent); TextView tvTitle=(TextView)row.findViewById(android.R.id.text1); tvTitle.setTextSize(30.0f); tvTitle.setText(getItem(position).getName()); return row; }
Example 25
From project Alerte-voirie-android, under directory /src/com/fabernovel/alertevoirie/.
Source file: MyIncidentsActivity.java

private void setAdapterForTab(final int tab){ try { setListAdapter(new JSONAdapter(this,data.getJSONArray(INCIDENTS[tab]),R.layout.cell_report_noicon,new String[]{JsonData.PARAM_INCIDENT_DESCRIPTION,JsonData.PARAM_INCIDENT_ADDRESS},new int[]{R.id.TextView_title,R.id.TextView_text},null,JsonData.PARAM_INCIDENT_DATE,R.layout.cell_category){ @Override protected String getCategoryOfItem( int itemId){ String date=super.getCategoryOfItem(itemId).substring(0,10); Log.d(Constants.PROJECT_TAG,date); return ((String)DateFormat.format("MMMM yyyy",new Date(Integer.parseInt(date.substring(0,4)),Integer.parseInt(date.substring(5,7)) - 1,Integer.parseInt(date.substring(8,10))))).replace("39","20"); } @Override public View getView( int position, View convertView, ViewGroup parent){ View v=super.getView(position,convertView,parent); if (getItemViewType(position) == TYPE_ITEM) { View arrow=v.findViewById(R.id.Arrow_details); if (isEnabled(position)) { arrow.setVisibility(View.VISIBLE); } else { arrow.setVisibility(View.GONE); } } return v; } @Override public boolean isEnabled( int position){ return tab != 2; } } ); } catch ( Exception e) { Log.e(Constants.PROJECT_TAG,"JSONException in setAdapterForTab",e); } }
Example 26
From project Alerte-voirie-android, under directory /src/com/fabernovel/alertevoirie/.
Source file: SelectCategoryActivity.java

@Override public View getView(int position,View convertView,ViewGroup parent){ View v=super.getView(position,convertView,parent); Cursor cur=(Cursor)getItem(position); int d=getResources().getIdentifier("pictocat" + cur.getLong(cur.getColumnIndex(BaseColumns._ID)),TYPEDRAWABLE,R.class.getPackage().getName()); ((ImageView)v.findViewById(R.id.ImageViewCat)).setImageResource(d); return v; }
Example 27
From project AmDroid, under directory /AmDroid/src/main/java/com/jaeckel/amenoid/.
Source file: CategoryListAdapter.java

@Override public View getView(final int position,View convertView,ViewGroup parent){ View row=convertView; Category category=getItem(position); ViewHolder holder; if (row == null) { holder=new ViewHolder(); row=inflater.inflate(textViewResourceId,parent,false); holder.categoryIcon=(RemoteImageView)row.findViewById(R.id.category_icon); holder.categoryName=(TextView)row.findViewById(R.id.category_name); holder.categorySubtitle=(TextView)row.findViewById(R.id.category_subtitle); row.setTag(holder); } else { holder=(ViewHolder)row.getTag(); } holder.categoryName.setText(category.getName()); holder.categorySubtitle.setText(category.getSubtitle()); if (!TextUtils.isEmpty(category.getIcon())) { holder.categoryIcon.setImageUrl(category.getIcon()); holder.categoryIcon.loadImage(); } return row; }
Example 28
From project AmDroid, under directory /AmDroid/src/main/java/com/jaeckel/amenoid/.
Source file: CommentListAdapter.java

@Override public View getView(final int position,View convertView,ViewGroup parent){ View row=convertView; Comment comment=getItem(position); ViewHolder holder; if (row == null) { holder=new ViewHolder(); row=inflater.inflate(textViewResourceId,parent,false); holder.user=(TextView)row.findViewById(R.id.user); holder.body=(TextView)row.findViewById(R.id.body); holder.delete=(ImageView)row.findViewById(R.id.delete); row.setTag(holder); } else { holder=(ViewHolder)row.getTag(); } final long comment_id=comment.getId(); holder.user.setText(comment.getUser().getName()); holder.body.setText(comment.getBody()); if (AmenoidApp.getInstance().getService().getMe() != null && AmenoidApp.getInstance().getService().getMe().getId() == comment.getUser().getId()) { holder.delete.setVisibility(View.VISIBLE); holder.delete.setOnClickListener(new View.OnClickListener(){ public void onClick( View v){ Log.d("CommentListAdapter","trash as trash can!!!: id: " + comment_id); new DeleteCommentTask(context).executeOnThreadPool(comment_id); } } ); } else { holder.delete.setVisibility(View.GONE); } return row; }