List of usage examples for android.widget FrameLayout FrameLayout
public FrameLayout(@NonNull Context context)
From source file:com.google.android.apps.santatracker.doodles.tilt.SwimmingFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (context == null) { return null; }// w w w. ja v a2 s .com levelManager = new SwimmingLevelManager(context); wrapper = new FrameLayout(context); titleView = getTitleView(R.drawable.penguin_swim_loadingscreen, R.string.swimming); wrapper.addView(titleView); getActivity().runOnUiThread(new Runnable() { @Override public void run() { loadGame(); } }); return wrapper; }
From source file:com.qianjiang.framework.widget.pulltorefresh.PullToRefreshListView.java
@Override protected final ListView createRefreshableView(Context context, AttributeSet attrs) { ListView lv = new InternalListView(context, attrs); // Get Styles from attrs TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PullToRefresh); // Create Loading Views ready for use later FrameLayout frame = new FrameLayout(context); mHeaderLoadingView = new HeaderLoadingLayout(context, Mode.PULL_DOWN_TO_REFRESH, a); frame.addView(mHeaderLoadingView, android.view.ViewGroup.LayoutParams.FILL_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT); mHeaderLoadingView.setVisibility(View.GONE); lv.addHeaderView(frame, null, false); mLvFooterLoadingFrame = new FrameLayout(context); mFooterLoadingView = new FooterLoadingLayout(context, Mode.PULL_UP_TO_REFRESH, a); mLvFooterLoadingFrame.addView(mFooterLoadingView, android.view.ViewGroup.LayoutParams.FILL_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT); mFooterLoadingView.setVisibility(View.GONE); a.recycle();/* www . j a v a2s.c om*/ // Set it to this so it can be used in ListActivity/ListFragment lv.setId(android.R.id.list); return lv; }
From source file:com.silentcircle.contacts.list.ScDefaultContactBrowseListFragment.java
@Override protected void onCreateView(LayoutInflater inflater, ViewGroup container) { super.onCreateView(inflater, container); mCounterHeaderView = (TextView) getOwnView().findViewById(R.id.contacts_count); // Create an empty user profile header and hide it for now (it will be visible if the // contacts list will have no user profile). addEmptyUserProfileHeader(inflater); showEmptyUserProfile(false);//from ww w. j a v a 2 s. c o m // Putting the header view inside a container will allow us to make // it invisible later. See checkHeaderViewVisibility() FrameLayout headerContainer = new FrameLayout(inflater.getContext()); mSearchHeaderView = inflater.inflate(R.layout.search_header, null, false); headerContainer.addView(mSearchHeaderView); getListView().addHeaderView(headerContainer, null, false); checkHeaderViewVisibility(); mSearchProgress = getOwnView().findViewById(R.id.search_progress); mSearchProgressText = (TextView) mSearchHeaderView.findViewById(R.id.totalContactsText); }
From source file:org.mariotaku.twidere.fragment.support.BaseSupportListFragment.java
/** * Provide default implementation to return a simple list view. Subclasses * can override to replace with their own layout. If doing so, the returned * view hierarchy <em>must</em> have a ListView whose id is * {@link android.R.id#list android.R.id.list} and can optionally have a * sibling view id {@link android.R.id#empty android.R.id.empty} that is to * be shown when the list is empty./*from www . j a v a 2 s . c om*/ * * <p> * If you are overriding this method with your own custom content, consider * including the standard layout {@link android.R.layout#list_content} in * your layout file, so that you continue to retain all of the standard * behavior of ListFragment. In particular, this is currently the only way * to have the built-in indeterminant progress state be shown. */ @Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final Context context = getActivity(); final FrameLayout root = new FrameLayout(context); // ------------------------------------------------------------------ final LinearLayout pframe = new LinearLayout(context); pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID); pframe.setOrientation(LinearLayout.VERTICAL); pframe.setVisibility(View.GONE); pframe.setGravity(Gravity.CENTER); final ProgressBar progress = new ProgressBar(context, 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)); // ------------------------------------------------------------------ final FrameLayout lframe = new FrameLayout(context); lframe.setId(INTERNAL_LIST_CONTAINER_ID); final TextView tv = new TextView(getActivity()); tv.setTextAppearance(context, ThemeUtils.getTextAppearanceLarge(context)); tv.setId(INTERNAL_EMPTY_ID); tv.setGravity(Gravity.CENTER); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); final ListView lv = new ListView(getActivity()); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lframe.addView(lv, 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)); // ------------------------------------------------------------------ root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); return root; }
From source file:com.facebook.notifications.internal.activity.CardActivity.java
private void beginLoadingContent() { if (assetManager == null || contentManager == null) { Log.e(LOG_TAG, "Asset & content manager should be available!"); return;/*w w w. j a va 2s . com*/ } if (configurationPayload == null) { Log.e(LOG_TAG, "No card payload is available!"); return; } ProgressBar loadingView = new ProgressBar(this); loadingView.setIndeterminate(true); int backgroundColor = ColorAssetHandler.fromRGBAHex(configurationPayload.optString("backdropColor")); FrameLayout loadingViewFrame = new FrameLayout(this); loadingViewFrame.setBackgroundColor(backgroundColor); LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); layoutParams.gravity = Gravity.CENTER; loadingViewFrame.addView(loadingView, layoutParams); setContentView(loadingViewFrame); final Handler handler = new Handler(); if (configurationPayload == null) { return; } assetManager.cachePayload(configurationPayload, new AssetManager.CacheCompletionCallback() { @Override public void onCacheCompleted(@NonNull JSONObject payload) { final CardConfiguration configuration; try { configuration = new CardConfiguration(configurationPayload, assetManager, contentManager); } catch (JSONException ex) { Log.e(LOG_TAG, "Error while parsing JSON", ex); return; } handler.post(new Runnable() { @Override public void run() { displayConfiguration(configuration); } }); } }); }
From source file:loon.LGame.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); try {// w ww .j ava 2 s.c o m LSystem.screenActivity = LGame.this; LGame.this.frameLayout = new FrameLayout(LGame.this); LGame.this.isDestroy = true; Runnable runnable = new Runnable() { @Override public void run() { LGame.this.onMain(); } }; runOnUiThread(runnable); } catch (Throwable ex) { LSystem.screenActivity = LGame.this; LGame.this.frameLayout = new FrameLayout(LGame.this); LGame.this.isDestroy = true; LGame.this.onMain(); } Log.i("Android2DActivity", "LGame 2D Engine Start"); }
From source file:com.hrs.filltheform.dialog.FillTheFormDialog.java
private void prepareDialogView() { windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); dialogParams = new WindowManager.LayoutParams(WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.TYPE_PHONE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, PixelFormat.TRANSLUCENT); dialogView = new FrameLayout(context); dialogView.setOnTouchListener(new View.OnTouchListener() { final Point screenSize = new Point(); @Override//from ww w.j a v a 2 s . com public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: windowManager.getDefaultDisplay().getSize(screenSize); model.setScreenDimensions(screenSize.x, screenSize.y); model.setInitialDialogPosition(dialogParams.x, dialogParams.y); model.setInitialTouchEvent(event.getRawX(), event.getRawY()); return true; case MotionEvent.ACTION_UP: model.onActionUp(); return true; case MotionEvent.ACTION_MOVE: model.onActionMove(event.getRawX(), event.getRawY()); return true; } return false; } }); @SuppressLint("InflateParams") final View dialogContent = LayoutInflater.from(context).inflate(R.layout.dialog, null); dialogMenu = dialogContent.findViewById(R.id.dialog_menu); expandIcon = dialogContent.findViewById(R.id.expand_icon); expandIconFastMode = dialogContent.findViewById(R.id.expand_icon_fast_mode); // Set up dialog content ImageButton closeButton = (ImageButton) dialogContent.findViewById(R.id.close_button); closeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { model.onCloseButtonClicked(); } }); ImageButton minimizeButton = (ImageButton) dialogContent.findViewById(R.id.minimize_button); minimizeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { model.onMinimizeButtonClicked(); } }); ImageButton openFillTheFormAppButton = (ImageButton) dialogContent .findViewById(R.id.open_fill_the_form_app_button); openFillTheFormAppButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { model.onOpenFillTheFormAppButtonClicked(); } }); fastModeButton = (ImageButton) dialogContent.findViewById(R.id.fast_mode_button); fastModeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { model.toggleFastMode(); } }); // Configuration items list configurationItemsView = (RecyclerView) dialogContent.findViewById(R.id.configuration_items_view); configurationItemsView.setHasFixedSize(true); configurationItemsView.setLayoutManager(new LinearLayoutManager(context)); // Set adapter configurationItemsAdapter = new ConfigurationItemsAdapter(context, model); configurationItemsView.setAdapter(configurationItemsAdapter); dialogView.addView(dialogContent); }
From source file:com.jaredrummler.android.colorpicker.ColorPickerDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { dialogId = getArguments().getInt(ARG_ID); showAlphaSlider = getArguments().getBoolean(ARG_ALPHA); showColorShades = getArguments().getBoolean(ARG_SHOW_COLOR_SHADES); colorShape = getArguments().getInt(ARG_COLOR_SHAPE); if (savedInstanceState == null) { color = getArguments().getInt(ARG_COLOR); dialogType = getArguments().getInt(ARG_TYPE); } else {//w ww . j a va2 s .c om color = savedInstanceState.getInt(ARG_COLOR); dialogType = savedInstanceState.getInt(ARG_TYPE); } rootView = new FrameLayout(getActivity()); if (dialogType == TYPE_CUSTOM) { rootView.addView(createPickerView()); } else if (dialogType == TYPE_PRESETS) { rootView.addView(createPresetsView()); } AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()).setView(rootView) .setPositiveButton(R.string.cpv_select, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { colorPickerDialogListener.onColorSelected(dialogId, color); } }); int dialogTitleStringRes = getArguments().getInt(ARG_DIALOG_TITLE); if (dialogTitleStringRes != 0) { builder.setTitle(dialogTitleStringRes); } int neutralButtonStringRes; if (dialogType == TYPE_CUSTOM && getArguments().getBoolean(ARG_ALLOW_PRESETS)) { neutralButtonStringRes = R.string.cpv_presets; } else if (dialogType == TYPE_PRESETS && getArguments().getBoolean(ARG_ALLOW_CUSTOM)) { neutralButtonStringRes = R.string.cpv_custom; } else { neutralButtonStringRes = 0; } if (neutralButtonStringRes != 0) { builder.setNeutralButton(neutralButtonStringRes, null); } return builder.create(); }
From source file:com.b44t.ui.PasscodeActivity.java
@Override public View createView(Context context) { actionBar//from ww w .j a v a 2 s. co m .setBackButtonImage(screen == SCREEN0_SETTINGS ? R.drawable.ic_ab_back : R.drawable.ic_close_white); actionBar.setAllowOverlayTitle(false); actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { @Override public void onItemClick(int id) { if (id == -1) { finishFragment(); } else if (id == done_button) { if (passcodeSetStep == 0) { processNext(); } else if (passcodeSetStep == 1) { processDone(); } } else if (id == pin_item) { currentPasswordType = 0; updateDropDownTextView(); } else if (id == password_item) { currentPasswordType = 1; updateDropDownTextView(); } } }); fragmentView = new FrameLayout(context); FrameLayout frameLayout = (FrameLayout) fragmentView; if (screen != SCREEN0_SETTINGS) { ActionBarMenu menu = actionBar.createMenu(); menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56)); titleTextView = new TextView(context); titleTextView.setTextColor(0xff757575); if (screen == SCREEN1_ENTER_CODE1) { if (UserConfig.passcodeHash.length() != 0) { titleTextView .setText(LocaleController.getString("EnterNewPasscode", R.string.EnterNewPasscode)); } else { titleTextView.setText( LocaleController.getString("EnterNewFirstPasscode", R.string.EnterNewFirstPasscode)); } } else { titleTextView .setText(LocaleController.getString("EnterCurrentPasscode", R.string.EnterCurrentPasscode)); } titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); titleTextView.setGravity(Gravity.CENTER_HORIZONTAL); frameLayout.addView(titleTextView); FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) titleTextView.getLayoutParams(); layoutParams.width = LayoutHelper.WRAP_CONTENT; layoutParams.height = LayoutHelper.WRAP_CONTENT; layoutParams.gravity = Gravity.CENTER_HORIZONTAL; layoutParams.topMargin = AndroidUtilities.dp(38); titleTextView.setLayoutParams(layoutParams); passwordEditText = new EditText(context); passwordEditText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); passwordEditText.setTextColor(0xff000000); passwordEditText.setMaxLines(1); passwordEditText.setLines(1); passwordEditText.setGravity(Gravity.CENTER_HORIZONTAL); passwordEditText.setSingleLine(true); if (screen == SCREEN1_ENTER_CODE1) { passcodeSetStep = 0; passwordEditText.setImeOptions(EditorInfo.IME_ACTION_NEXT); } else { passcodeSetStep = 1; passwordEditText.setImeOptions(EditorInfo.IME_ACTION_DONE); } passwordEditText.setTransformationMethod(PasswordTransformationMethod.getInstance()); passwordEditText.setTypeface(Typeface.DEFAULT); AndroidUtilities.clearCursorDrawable(passwordEditText); frameLayout.addView(passwordEditText); layoutParams = (FrameLayout.LayoutParams) passwordEditText.getLayoutParams(); layoutParams.topMargin = AndroidUtilities.dp(90); layoutParams.height = AndroidUtilities.dp(36); layoutParams.leftMargin = AndroidUtilities.dp(40); layoutParams.gravity = Gravity.TOP | Gravity.LEFT; layoutParams.rightMargin = AndroidUtilities.dp(40); layoutParams.width = LayoutHelper.MATCH_PARENT; passwordEditText.setLayoutParams(layoutParams); passwordEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) { if (passcodeSetStep == 0) { processNext(); return true; } else if (passcodeSetStep == 1) { processDone(); return true; } return false; } }); passwordEditText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { if (passwordEditText.length() == 4) { if (screen == SCREEN2_ENTER_CODE2 && UserConfig.passcodeType == 0) { processDone(); } else if (screen == SCREEN1_ENTER_CODE1 && currentPasswordType == 0) { if (passcodeSetStep == 0) { processNext(); } else if (passcodeSetStep == 1) { processDone(); } } } } }); passwordEditText.setCustomSelectionActionModeCallback(new ActionMode.Callback() { public boolean onPrepareActionMode(ActionMode mode, Menu menu) { return false; } public void onDestroyActionMode(ActionMode mode) { } public boolean onCreateActionMode(ActionMode mode, Menu menu) { return false; } public boolean onActionItemClicked(ActionMode mode, MenuItem item) { return false; } }); if (screen == SCREEN1_ENTER_CODE1) { dropDownContainer = new ActionBarMenuItem(context, menu, 0); dropDownContainer.setSubMenuOpenSide(1); dropDownContainer.addSubItem(pin_item, LocaleController.getString("PasscodePIN", R.string.PasscodePIN), 0); dropDownContainer.addSubItem(password_item, LocaleController.getString("PasscodePassword", R.string.PasscodePassword), 0); actionBar.addView(dropDownContainer); layoutParams = (FrameLayout.LayoutParams) dropDownContainer.getLayoutParams(); layoutParams.height = LayoutHelper.MATCH_PARENT; layoutParams.width = LayoutHelper.WRAP_CONTENT; layoutParams.rightMargin = AndroidUtilities.dp(40); layoutParams.leftMargin = AndroidUtilities.isTablet() ? AndroidUtilities.dp(64) : AndroidUtilities.dp(56); layoutParams.gravity = Gravity.TOP | Gravity.LEFT; dropDownContainer.setLayoutParams(layoutParams); dropDownContainer.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { dropDownContainer.toggleSubMenu(); } }); dropDown = new TextView(context); dropDown.setGravity(Gravity.LEFT); dropDown.setSingleLine(true); dropDown.setLines(1); dropDown.setMaxLines(1); dropDown.setEllipsize(TextUtils.TruncateAt.END); dropDown.setTextColor(0xffffffff); dropDown.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_arrow_drop_down, 0); dropDown.setCompoundDrawablePadding(AndroidUtilities.dp(4)); dropDown.setPadding(0, 0, AndroidUtilities.dp(10), 0); dropDownContainer.addView(dropDown); layoutParams = (FrameLayout.LayoutParams) dropDown.getLayoutParams(); layoutParams.width = LayoutHelper.WRAP_CONTENT; layoutParams.height = LayoutHelper.WRAP_CONTENT; layoutParams.leftMargin = AndroidUtilities.dp(16); layoutParams.gravity = Gravity.CENTER_VERTICAL; layoutParams.bottomMargin = AndroidUtilities.dp(1); dropDown.setLayoutParams(layoutParams); } else { actionBar.setTitle(LocaleController.getString("Passcode", R.string.Passcode)); } updateDropDownTextView(); } else { actionBar.setTitle(LocaleController.getString("Passcode", R.string.Passcode)); frameLayout.setBackgroundColor(0xfff0f0f0); listView = new ListView(context); listView.setDivider(null); listView.setDividerHeight(0); listView.setVerticalScrollBarEnabled(false); listView.setDrawSelectorOnTop(true); frameLayout.addView(listView); FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams(); layoutParams.width = LayoutHelper.MATCH_PARENT; layoutParams.height = LayoutHelper.MATCH_PARENT; layoutParams.gravity = Gravity.TOP; listView.setLayoutParams(layoutParams); listView.setAdapter(listAdapter = new ListAdapter(context)); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, final int i, long l) { if (i == changePasscodeRow) { presentFragment(new PasscodeActivity(SCREEN1_ENTER_CODE1)); } else if (i == passcodeOnOffRow) { TextCheckCell cell = (TextCheckCell) view; if (UserConfig.passcodeHash.length() != 0) { UserConfig.passcodeHash = ""; UserConfig.appLocked = false; UserConfig.saveConfig(false); int count = listView.getChildCount(); for (int a = 0; a < count; a++) { View child = listView.getChildAt(a); if (child instanceof TextSettingsCell) { TextSettingsCell textCell = (TextSettingsCell) child; textCell.setTextColor(0xffc6c6c6); break; } } cell.setChecked(UserConfig.passcodeHash.length() != 0); NotificationCenter.getInstance() .postNotificationName(NotificationCenter.didSetPasscode); } else { presentFragment(new PasscodeActivity(SCREEN1_ENTER_CODE1)); } } else if (i == autoLockRow) { if (getParentActivity() == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setTitle(LocaleController.getString("AutoLock", R.string.AutoLock)); final NumberPicker numberPicker = new NumberPicker(getParentActivity()); numberPicker.setMinValue(0); numberPicker.setMaxValue(4); if (UserConfig.autoLockIn == 0) { numberPicker.setValue(0); } else if (UserConfig.autoLockIn == 60) { numberPicker.setValue(1); } else if (UserConfig.autoLockIn == 60 * 5) { numberPicker.setValue(2); } else if (UserConfig.autoLockIn == 60 * 60) { numberPicker.setValue(3); } else if (UserConfig.autoLockIn == 60 * 60 * 5) { numberPicker.setValue(4); } numberPicker.setFormatter(new NumberPicker.Formatter() { @Override public String format(int value) { if (value == 0) { return LocaleController.getString("Disabled", R.string.Disabled); } else if (value == 1) { return ApplicationLoader.applicationContext.getResources() .getQuantityString(R.plurals.Minutes, 1, 1); } else if (value == 2) { return ApplicationLoader.applicationContext.getResources() .getQuantityString(R.plurals.Minutes, 5, 5); } else if (value == 3) { return ApplicationLoader.applicationContext.getResources() .getQuantityString(R.plurals.Hours, 1, 1); } else if (value == 4) { return ApplicationLoader.applicationContext.getResources() .getQuantityString(R.plurals.Hours, 5, 5); } return ""; } }); numberPicker.setWrapSelectorWheel(false); builder.setView(numberPicker); builder.setNegativeButton(LocaleController.getString("Done", R.string.Done), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { which = numberPicker.getValue(); if (which == 0) { UserConfig.autoLockIn = 0; } else if (which == 1) { UserConfig.autoLockIn = 60; } else if (which == 2) { UserConfig.autoLockIn = 60 * 5; } else if (which == 3) { UserConfig.autoLockIn = 60 * 60; } else if (which == 4) { UserConfig.autoLockIn = 60 * 60 * 5; } listView.invalidateViews(); UserConfig.saveConfig(false); } }); showDialog(builder.create()); } else if (i == fingerprintRow) { UserConfig.useFingerprint = !UserConfig.useFingerprint; UserConfig.saveConfig(false); ((TextCheckCell) view).setChecked(UserConfig.useFingerprint); } } }); } return fragmentView; }
From source file:org.dmfs.webcal.adapters.SectionTitlesAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { int itemPos = itemPos(mIndex.get(position)); if (itemPos == HEADER_ID) { String title = mIndexer.getSectionTitle((int) sectionId(mIndex.get(position))); // this is a section header if (convertView == null || convertView instanceof FrameLayout && !TextUtils.isEmpty(title)) { convertView = mInflater.inflate(mSectionHeaderViewId, parent, false); }//from w w w .j av a 2 s . co m if (mHideEmptySectionTitle && TextUtils.isEmpty(title)) { // setting visibility of convertView doesn't work, we need to return an empty view return new FrameLayout(mInflater.getContext()); } else { ((TextView) convertView.findViewById(android.R.id.title)).setText(title); return convertView; } } else { // just forward the request to the wrapped adapter return mAdaptedAdapter.getView(itemPos, convertView, parent); } }