private void setMoreRing() { String[] menustring = new String[] {"设为来电铃声", "设为提示音", "设为闹铃声"}; ListView menulist = new ListView(context); menulist.setCacheColorHint(Color.TRANSPARENT); menulist.setDividerHeight(1); menulist.setAdapter( new ArrayAdapter<String>(context, R.layout.dialog_menu_item, R.id.text1, menustring)); menulist.setLayoutParams( new LayoutParams(MainActivity.getScreen(context)[0] / 2, LayoutParams.WRAP_CONTENT)); final CustomDialog xfdialog = new CustomDialog.Builder(context).setTitle("您要将文件处理为:").setView(menulist).create(); xfdialog.show(); menulist.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { xfdialog.cancel(); xfdialog.dismiss(); if (position == 0) { MainActivity.this.setMyRingtone(); } // 设为来电铃声 else if (position == 1) { MainActivity.this.setMyNotification(); } else if (position == 2) { MainActivity.this.setMyAlarm(); } } }); }
private View getPopupWindowLayout() { if (contentView == null) { if (lAdapter != null) { contentView = new ListView(context); contentView.setLayoutParams( new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); contentView.setCacheColorHint(Color.argb(0, 0, 0, 0)); if (backgroundId != 0) { contentView.setBackgroundResource(backgroundId); } else { contentView.setBackgroundColor(Color.argb(0, 0, 0, 0)); } contentView.setPadding( contentPadding[0], contentPadding[1], contentPadding[2], contentPadding[3]); contentView.setFadingEdgeLength(0); if (divider == null) { contentView.setDivider(null); contentView.setDividerHeight(0); } else { contentView.setDivider(divider); contentView.setDividerHeight(dividerHeight); } contentView.setAdapter(lAdapter); } } return contentView; }
/* * display menu * */ public void menu() { /* * view for list of items for the menu */ final ListView listmenu = (ListView) findViewById(R.id.listmenu); String[] listeStrings = {"Play", "Open", "Edit", "Save", "Share Position", "Share DeadHal"}; listmenu.setClickable(true); listmenu.setFocusable(true); /* * defines actions for every item of the menu */ listmenu.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { if (position == 0) { graphicRoom.setEdit(false); } if (position == 1) {} if (position == 2) { graphicRoom.setEdit(true); } if (position == 3) {} if (position == 4) {} if (position == 5) {} } }); int[] colors = {0, Color.WHITE, 0}; listmenu.setDivider(new GradientDrawable(Orientation.RIGHT_LEFT, colors)); listmenu.setDividerHeight(1); listmenu.setAdapter( new ArrayAdapter<String>(this, R.layout.list_menu, R.id.list_content, listeStrings)); }
/** * 통신 모듈의 명명 규칙 1) 파서관련 클래스 이름은 프로토콜문서의 Api이름을 기준으로 만든다. 2) 통신모듈을 사용하는 Activity나 Fragment의 클래스이름은 * 이미 화면구성과 기능에 따라 이름이 정해져있다. (통신모듈과 이름이 같을 수 있는데...) 3) 파서관련 클래스의 내부 필드명은 프로토콜문서의 elements 이름을 * 기준으로 한다. 어차피 해당프로토콜를 의미하는 단어는 생략한다. (예, VOD_ID --> ID) : 이름은 첫글자는 소문자로 하고 다음 단어는 시작 글자만 대문자로 * 한다. "_"은 사용하지 않는다. (예, areaCode) : element이름과 연관된 string 상수는 모두 대문자로 하고 단어와 단어사이는 "_"을 사용한다. * (예, AREA_CODE) 4) 요청 url은 요청하는 클래스에서 만들어 파서로 전달하는걸 원칙으로 하자. */ @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View layout = inflater.inflate(R.layout.vod_semidetail, container, false); preventClickDispatching = (FrameLayout) layout.findViewById(R.id.search_vod_prevent_click_dispatching); preventClickDispatching.setOnClickListener(this); // listview listView = (ListView) layout.findViewById(R.id.vod_semidetail); listView.setDivider(null); listView.setDividerHeight(0); listView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Fragment f = getActivity() .getSupportFragmentManager() .findFragmentByTag(((MainActivity) getActivity()).TAG_FRAGMENT_SEARCH); if (f != null) { ((SearchMain) f).showDetailVod(); } } }); return layout; }
@Override protected void configureList(Activity activity, ListView listView) { super.configureList(activity, listView); listView.setDividerHeight(0); updateHeaders(items); }
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.list_view); ListView listView = (ListView) findViewById(R.id.list_view); mGoogleCardsAdapter = new GoogleCardsSocialAdapter(this, DummyContent.getDummyModelList()); SwingBottomInAnimationAdapter swingBottomInAnimationAdapter = new SwingBottomInAnimationAdapter(new SwipeDismissAdapter(mGoogleCardsAdapter, this)); swingBottomInAnimationAdapter.setAbsListView(listView); assert swingBottomInAnimationAdapter.getViewAnimator() != null; swingBottomInAnimationAdapter.getViewAnimator().setInitialDelayMillis(INITIAL_DELAY_MILLIS); listView.setClipToPadding(false); listView.setDivider(null); Resources r = getResources(); int px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, r.getDisplayMetrics()); listView.setDividerHeight(px); listView.setFadingEdgeLength(0); listView.setFitsSystemWindows(true); px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 12, r.getDisplayMetrics()); listView.setPadding(px, px, px, px); listView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY); listView.setAdapter(swingBottomInAnimationAdapter); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle("Google cards social"); }
private void showChildPopWindow(View view) { // 一个自定义的布局,作为显示的内容 View contentView = LayoutInflater.from(DrugListActivity.this).inflate(R.layout.popupwindow_parent, null); // 设置按钮的点击事件 PopupWindow popupWindow = new PopupWindow( contentView, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT, true); popupWindow.setWidth(ScreenUtils.getScreenWidth(DrugListActivity.this) / 2); popupWindow.setHeight(ScreenUtils.getScreenHeight(DrugListActivity.this) / 2); ListView listView = (ListView) contentView.findViewById(R.id.popupwindow_parent_lv); listView.setAdapter( new ArrayAdapter<String>(this, R.layout.fragment_druglist_child_item, mChildList)); listView.setDividerHeight(0); popupWindow.setTouchable(true); // DrugListActivity.this.getWindow().getAttributes().alpha = 0.7f; // DrugListActivity.this.getWindow().setAttributes(params); backgroundAlpha(0.7f); // 如果不设置PopupWindow的背景,无论是点击外部区域还是Back键都无法dismiss弹框 popupWindow.setBackgroundDrawable(new BitmapDrawable()); popupWindow.setOnDismissListener( new PopupWindow.OnDismissListener() { @Override public void onDismiss() { backgroundAlpha(1f); } }); // 设置好参数之后再show popupWindow.showAsDropDown(view); }
protected void onCreateView(LayoutInflater inflater, ViewGroup container) { mView = inflateView(inflater, container); mListView = (ListView) mView.findViewById(android.R.id.list); if (mListView == null) { throw new RuntimeException( "Your content must have a ListView whose id attribute is " + "'android.R.id.list'"); } View emptyView = mView.findViewById(android.R.id.empty); if (emptyView != null) { mListView.setEmptyView(emptyView); } mListView.setOnItemClickListener(this); mListView.setOnFocusChangeListener(this); mListView.setOnTouchListener(this); mListView.setFastScrollEnabled(!isSearchMode()); // Tell list view to not show dividers. We'll do it ourself so that we can *not* show // them when an A-Z headers is visible. mListView.setDividerHeight(0); // We manually save/restore the listview state mListView.setSaveEnabled(false); configureVerticalScrollbar(); configurePhotoLoader(); }
/** Create menu drawer ListView and listeners */ private void initMenuDrawer() { mListView = new ListView(this); mListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); mListView.setDivider(null); mListView.setDividerHeight(0); mListView.setCacheColorHint(android.R.color.transparent); String[] blogNames = getBlogNames(); if (blogNames.length > 1) { addBlogSpinner(blogNames); } mListView.setOnItemClickListener(mItemClickListener); mListView.setOnScrollListener( new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) {} @Override public void onScroll( AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { mMenuDrawer.invalidate(); } }); mMenuDrawer.setMenuView(mListView); updateMenuDrawer(); }
/** 图片截图框 */ protected void showDialogPicSelect() { final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this, R.layout.item_text); arrayAdapter.add("分享图片"); arrayAdapter.add("保存图片至图册"); arrayAdapter.add("保存图片至文件夹"); ListView listView = new ListView(this); float scale = getResources().getDisplayMetrics().density; int dpAsPixels = (int) (8 * scale + 0.5f); listView.setPadding(0, dpAsPixels, 0, dpAsPixels); listView.setDividerHeight(0); listView.setAdapter(arrayAdapter); final MaterialDialog alert = new MaterialDialog(this).setContentView(listView); listView.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { alert.dismiss(); switch (position) { case 0: sharePic(); break; case 1: savePicInGarrery(); break; case 2: savePicInSdCard(); break; } } }); alert.show(); }
@Override public void onStart() { super.onStart(); Bundle args = getArguments(); if (args != null) { // Set article based on argument passed in mPrefsIndex = args.getInt(ORDER_PREFERENCES_INDEX, mPrefsIndex); mHueStart = args.getFloat(ARG_HUE_START, 0); mHueEnd = args.getFloat(ARG_HUE_END, 360); mSaturation = args.getFloat(ARG_SATURATION, 1); mValue = args.getFloat(ARG_VALUE, 1); // Log.d("Args:", " HueStart: " + mHueStart + " HueEnd: " + mHueEnd + " Sat:" + mSaturation + // " Val: " + mValue); } ListView lv = (ListView) getActivity().findViewById(R.id.list); lv.setDividerHeight(2); fillData(lv); setListListener(lv); Button configButton = (Button) getActivity().findViewById(R.id.button); configButton.setText(R.string.config_sort_order); setButtonListener(configButton); }
public void userDogs(View view) { AlertDialog.Builder userDogsDialog = new AlertDialog.Builder(PublicUserProfileActivity.this); userDogsDialog.setTitle("User Dogs"); final ListView modeList = new ListView(PublicUserProfileActivity.this); modeList.setAdapter(adapter); modeList.setDividerHeight(modeList.getDividerHeight() * 3); userDogsDialog.setView(modeList); modeList.setOnItemClickListener( new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Dog dog = (Dog) modeList.getItemAtPosition(position); Intent clickedWalkProfile = new Intent(getApplicationContext(), PublicDogProfileActivity.class); clickedWalkProfile.putExtra("DOG", dog); startActivity(clickedWalkProfile); } }); AlertDialog alertDogs = userDogsDialog.create(); alertDogs.show(); }
public void onCreate(Bundle paramBundle) { super.onCreate(paramBundle); requestWindowFeature(Window.FEATURE_ACTION_BAR); setContentView(R.layout.idiomcategorieslist); mainLayout = (RelativeLayout) findViewById(R.id.catparent); indicatorLayout = ActivityIndicator.getActivityIndicatorLayout(this); langName = getIntent().getExtras().getString("langname"); ActionBar actionBar = getActionBar(); ActionBarProperties.setupActionBar(this, actionBar, "Idioms & Phrases", langName, true); ListView localListView = (ListView) findViewById(R.id.idiomcategories); this.adaptor = new IdiomsCategoryListAdaptor( this, R.id.categoryname, IdiomsDataSource.getInstance(this).getIdiomCategoryNames(langName)); localListView.setAdapter(this.adaptor); int[] arrayOfInt = {0xFF000000, 0xFF000000, 0xFF000000}; localListView.setDivider( new GradientDrawable(GradientDrawable.Orientation.RIGHT_LEFT, arrayOfInt)); localListView.setDividerHeight(1); localListView.setOnItemClickListener(this); localListView.requestFocusFromTouch(); ((EditText) findViewById(R.id.search)).addTextChangedListener(this); }
@Override protected void onBindDialogView(View view) { super.onBindDialogView(view); lv = (ListView) view.findViewById(R.id.appsList); lv.setOnItemClickListener(this); lv.setFastScrollEnabled(true); lv.setFadingEdgeLength(1); lv.setDivider(null); lv.setDividerHeight(0); lv.setScrollingCacheEnabled(false); pb = (ProgressBar) view.findViewById(R.id.progressBar); if (isSearch) { search = (EditText) view.findViewById(R.id.searchApp); search.setVisibility(View.VISIBLE); createList(); search.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) { appListAdapter.getFilter().filter(s); } @Override public void afterTextChanged(Editable s) {} }); } else { createList(); } }
private ListView createOverflowListView() { final Context context = mContentView.getContext(); final ListView overflowListView = new ListView(context); overflowListView.setLayoutParams( new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); overflowListView.setDivider(null); overflowListView.setDividerHeight(0); final ArrayAdapter overflowListViewAdapter = new ArrayAdapter<MenuItem>(context, 0) { @Override public View getView(int position, View convertView, ViewGroup parent) { TextView menuButton; if (convertView != null) { menuButton = (TextView) convertView; } else { menuButton = createOverflowMenuItemButton(context); } MenuItem menuItem = getItem(position); menuButton.setText(menuItem.getTitle()); menuButton.setContentDescription(menuItem.getTitle()); menuButton.setMinimumWidth(mOverflowWidth); return menuButton; } }; overflowListView.setAdapter(overflowListViewAdapter); return overflowListView; }
public UserDetail(Context context, AttributeSet attrs) { super(context, attrs); // TODO Auto-generated constructor stub LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater.inflate(R.layout.linearlayout_userdetail, this); imageviewbili = (ImageView) findViewById(R.id.littletv); imageviewbili.setOnTouchListener(this); imageviewbili.setBackgroundResource(R.drawable.bili_up); ImageView usericon = (ImageView) findViewById(R.id.usericon); TextView textview = (TextView) findViewById(R.id.username); RelativeLayout.LayoutParams layoutParamsb = (RelativeLayout.LayoutParams) imageviewbili.getLayoutParams(); layoutParamsb.height = (int) (MainActivity.window_height * 3 / 11 / 1.5); layoutParamsb.width = 270 * layoutParamsb.height / 208; imageviewbili.setLayoutParams(layoutParamsb); StyleController.contextinStyleController = context; setusernametextTheme(textview); data = getData(); UserDetailAdapter adapter = new UserDetailAdapter(context); lv = (ListView) findViewById(R.id.userlv); lv.setAdapter(adapter); lv.setDividerHeight(1); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_search); _imgDownloader = new ImageDownloader(this); _imgDownloader.setImageFilePrefix(AppConfig.IMAGE_CACHE_FILE_PREFIX); // 标题 TextView titleTextView = (TextView) this.findViewById(R.id.textViewTitle); titleTextView.setText("搜索"); _loadingLayer = (ViewGroup) findViewById(R.id.loading_layer); _loadingImageView = (ImageView) _loadingLayer.findViewById(R.id.imageViewLoading); _loadingTextView = (TextView) _loadingLayer.findViewById(R.id.textViewLoading); _inputBoxTextView = (TextView) this.findViewById(R.id.textViewInputBox); _listView = (ListView) this.findViewById(R.id.listView); _listView.setDividerHeight(0); _listView.setSelector(R.drawable.bg_download_list_selected); _listView.setVerticalScrollBarEnabled(true); _listView.setOnItemClickListener(this); _adapter = new MyAdapter(this); _listView.setAdapter(_adapter); buildKeyboard(); // HomeDataLoader.loadAllAppList(this, _allAppList); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /** This will set the bundles saved state */ setContentView(R.layout.download_list); // _adView = (AdView) findViewById(R.id.ad_view); _list = (ListView) findViewById(R.id.list); _list.setDividerHeight(0); // _adView.setListener(new AdViewListener() { // public void onReceiveAd() { // Log.d("MyActivity", "Tap for Tap ad received"); // } // // public void onFailToReceiveAd(String reason) { // Log.d("MyActivity", "Tap for Tap failed to receive ad: " + reason); // } // // public void onTapAd() { // Log.d("MyActivity", "Tap for Tap ad tapped"); // } // }); doAddItems(); ActionBar bar = getSupportActionBar(); bar.setDisplayHomeAsUpEnabled(true); _list.setOnItemClickListener(this); registerForContextMenu(_list); }
@Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // add data to ListView for (int i = 0, count = 20; i < count; i++) { mDataSourceList.add("列表数据" + i); } ArrayList<User> arUser; arUser = new ArrayList<User>(); User user; user = new User("1", "pppgod", "이상윤"); arUser.add(user); user = new User("2", "dodo3371", "김정은"); arUser.add(user); UserAdapter adapter = new UserAdapter(getActivity(), R.layout.custom_rank_list, arUser); ListView list; list = (ListView) getActivity().findViewById(R.id.list_all); list.setAdapter(adapter); list.setDividerHeight(2); list.setOnItemLongClickListener( new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { Intent intent = new Intent(getActivity(), UserInfoActivity.class); startActivity(intent); return false; } }); }
public static void setListViewStyle( ListView view, Drawable divider_drawable, int height_px, boolean show_bar) { view.setCacheColorHint(Color.TRANSPARENT); view.setSelector(new ColorDrawable(Color.TRANSPARENT)); view.setDivider(divider_drawable); view.setDividerHeight(height_px); view.setVerticalScrollBarEnabled(show_bar); }
/** 竞彩子列表view */ private void showJcListView(JSONObject jsonObj) { List<JcInfo> list_jc = getSubInfoForListView(jsonObj); // 获取缓存中的数据 // 初始化列表 ListView listview = (ListView) findViewById(R.id.notice_prizes_single_specific_listview); JcInfoAdapter adapter = new JcInfoAdapter(this, list_jc); listview.setDividerHeight(0); listview.setAdapter(adapter); }
@Override public void onActivityCreated(Bundle savedInstanceState) { ListView list = (ListView) getView().findViewById(android.R.id.list); list.setDivider(new ColorDrawable(Color.parseColor("#f5f5f5"))); list.setDividerHeight((int) getParentActivity().getResources().getDisplayMetrics().density); super.onActivityCreated(savedInstanceState); }
public void onClick(View paramView) { switch (paramView.getId()) { default: super.onClick(paramView); return; case 2131361873: case 2131362054: this.mProfileHeaderAdapter.onProfileHeaderClick(paramView, this); return; case 2131362056: case 2131362058: this.mProfileHeaderAdapter.onProfileHeaderClick(paramView, this); changeTab((Button)paramView); return; case 2131362051: onFollowersClicked(); return; case 2131362053: onFollowingClicked(); return; case 2131361949: this.mAppController.acceptFollowRequest(this.mAppController.getActiveSession(), this.mUserId); return; case 2131361946: this.mAppController.acceptRejectRequest(this.mAppController.getActiveSession(), this.mUserId); return; case 2131362057: } if (this.mHideProfileReposts); for (int i = 2131624352; ; i = 2131624148) { String str = getString(i); ArrayAdapter localArrayAdapter = new ArrayAdapter(getActivity(), 2130903120, 2131361987, new String[] { str }); ListView localListView = new ListView(getActivity()); FrameLayout.LayoutParams localLayoutParams = new FrameLayout.LayoutParams(-1, -2); localLayoutParams.topMargin = getResources().getDimensionPixelSize(2131427412); localListView.setPadding(0, getResources().getDimensionPixelSize(2131427412), 0, 0); localListView.setLayoutParams(localLayoutParams); localListView.setAdapter(localArrayAdapter); localListView.setSelector(new ColorDrawable(getResources().getColor(17170445))); localListView.setOnItemClickListener(this); localListView.setDividerHeight(0); if (getView() == null) break; TabButton localTabButton = (TabButton)getView().findViewById(2131362056); if ((this.mPopupWindow == null) || (this.mPopupWindow.isShowing()) || (localTabButton == null)) break; this.mPopupWindow.setFocusable(true); this.mPopupWindow.setContentView(localListView); this.mPopupWindow.setWidth(localTabButton.getMeasuredWidth()); this.mPopupWindow.setHeight(-2); this.mPopupWindow.setBackgroundDrawable(new ColorDrawable(getResources().getColor(2131296358))); this.mPopupWindow.showAsDropDown(localTabButton, 0, 0); return; } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.select_recipients_list_screen); if (savedInstanceState != null) { mMode = savedInstanceState.getInt(MODE); } else { mMode = getIntent().getIntExtra(MODE, MODE_INFO); } if (mMode == MODE_INFO || mMode == MODE_VCARD) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.edit().putBoolean(PREF_SHOW_GROUPS, false).commit(); } else { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.edit().putBoolean(PREF_SHOW_GROUPS, true).commit(); } switch (mMode) { case MODE_INFO: setTitle(R.string.attach_add_contact_as_text); break; case MODE_VCARD: setTitle(R.string.attach_add_contact_as_vcard); break; default: // leave it be } mProgressSpinner = findViewById(R.id.progress_spinner); // List view ListView listView = getListView(); if (mMode == MODE_VCARD) { listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE); } else { listView.setChoiceMode(ListView.CHOICE_MODE_NONE); } listView.setFastScrollEnabled(true); listView.setFastScrollAlwaysVisible(true); listView.setDivider(null); listView.setDividerHeight(0); listView.setEmptyView(findViewById(R.id.empty)); listView.setOnItemClickListener(this); // Get things ready mCheckedPhoneNumbers = new HashSet<PhoneNumber>(); mLocalGroups = new HashSet<Group>(); getLoaderManager().initLoader(0, null, this); ActionBar mActionBar = getActionBar(); if (mActionBar != null) { mActionBar.setDisplayHomeAsUpEnabled(true); } }
public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_list, container, false); int[] colors = {parseColor("#CEFFC2"), parseColor("#3FA9F5"), parseColor("#CEFFC2")}; ListView myList = (ListView) view.findViewById(R.id.listElements); myList.setDivider(new GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT, colors)); myList.setDividerHeight(3); return view; }
@Override public void onCreate(Bundle savedState) { super.onCreate(savedState); thumbSize = getResources().getInteger(R.integer.config_list_thumb_size); if (savedState != null) { String cropTempPath = savedState.getString("crop_temp"); if (cropTempPath != null) cropTemp = new File(cropTempPath); pickedRawContact = savedState.getInt("picked_raw_contact", 0); } // Initialize cache directory new File(getCacheDir(), DISK_CACHE_DIR).mkdir(); unchangedThumb = new BitmapDrawable(getResources(), Bitmap.createBitmap(1, 1, Config.ALPHA_8)); setContentView(R.layout.activity_assign_contact_photo); contactList = (ListView) findViewById(R.id.contactList); emptyList = (TextView) findViewById(R.id.empty); loadingProgress = (ProgressBar) findViewById(R.id.loading); contactList.setEmptyView(loadingProgress); contactList.setAdapter(new ContactAdapter()); contactList.setDividerHeight(1); contactList.setMultiChoiceModeListener(new ContactListMultiChoiceModeListener()); contactList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); getActionBar().setDisplayHomeAsUpEnabled(true); account = getIntent().getStringExtra("account"); setTitle(account); thumbMemCache = new SparseArray<Drawable>(); asyncTasks = new HashSet<AsyncTask<?, ?, ?>>(); defaultThumb = getResources().getDrawable(R.drawable.new_picture); contactList.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View view, int position, long id) { pickedRawContact = ((Contact) contactList.getItemAtPosition(position)).rawContactId; Intent intent = new Intent(); // We only really accept PNG and JPEG but the activities registered for // the intended action only accept the generic form of the mime type. We // will check for our constraints after the image is picked. intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult( Intent.createChooser(intent, getResources().getString(R.string.select_picture)), REQ_CODE_PICK_IMAGE); } }); }
@Override protected void configureList(Activity activity, ListView listView) { super.configureList(activity, listView); listView.setFastScrollEnabled(true); listView.setDividerHeight(0); getListAdapter() .addHeader(activity.getLayoutInflater().inflate(R.layout.checkins_list_item_labels, null)); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.universites); lv = (ListView) findViewById(R.id.listview); Ulists u = new Ulists(this, uname); lv.setAdapter(u); lv.setDivider(new ColorDrawable(Color.TRANSPARENT)); lv.setDividerHeight(12); lv.setOnItemClickListener(this); }
public void handleMessage(Message msg) { ListView app_listView = (ListView) findViewById(R.id.listview); app_listView.setDividerHeight(10); AppAdapter appAdapter = new AppAdapter(GTShowPackageActivity.this, appList); app_listView.setDividerHeight(5); if (app_listView != null) { app_listView.setAdapter(appAdapter); app_listView.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { backToSetting(arg2); } }); } if (proDialog != null) { proDialog.dismiss(); } }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.item_list); DBAdapter dbAdapter = new DBAdapter(this); intent = getIntent(); // app = (InitializeMenuPages) getApplicationContext(); itemList = getListView(); itemList.setDivider(new ColorDrawable(0xffE6E6E6)); itemList.setDividerHeight(1); TextView item = (TextView) findViewById(R.id.lblTitle); btnCancel = (Button) findViewById(R.id.btnCancel); // strCity = app.getCity(); strItem = intent.getStringExtra("item"); strMeals = getResources().getStringArray(R.array.meals_array); strFeatures = getResources().getStringArray(R.array.features_array); itemList.setOnItemClickListener( new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int pos, long id) { // TODO Auto-generated method stub listOnItemClick(parent, view, pos, id); } }); btnCancel.setOnClickListener( new OnClickListener() { public void onClick(View view) { // TODO Auto-generated method stub btnCancelOnClick(view); } }); item.setText(strItem); // btnCancel.setText(strCity); if (strItem.equals("Cuisines")) { strCuisines = dbAdapter.getCuisines(); setListAdapter(new ArrayAdapter<String>(this, R.layout.item_row, strCuisines)); } if (strItem.equals("Meals")) { setListAdapter(new ArrayAdapter<String>(this, R.layout.item_row, strMeals)); } if (strItem.equals("Features")) { setListAdapter(new ArrayAdapter<String>(this, R.layout.item_row, strFeatures)); } }