@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); ListView lv = getListView(); // getListView().setSelector(R.drawable.transparent); lv.setCacheColorHint(Color.TRANSPARENT); // View management View detailsFrame = getActivity().findViewById(R.id.details); dualPane = detailsFrame != null && detailsFrame.getVisibility() == View.VISIBLE; if (savedInstanceState != null) { // Restore last state for checked position. curCheckPosition = savedInstanceState.getLong(CURRENT_CHOICE, SipProfile.INVALID_ID); // curCheckWizard = savedInstanceState.getString(CURRENT_WIZARD); } setListShown(false); if (mAdapter == null) { if (mHeaderView != null) { lv.addHeaderView(mHeaderView, null, true); } mAdapter = new AccountsEditListAdapter(getActivity(), null); mAdapter.setOnCheckedRowListener(this); // getListView().setEmptyView(getActivity().findViewById(R.id.progress_container)); // getActivity().findViewById(android.R.id.empty).setVisibility(View.GONE); setListAdapter(mAdapter); registerForContextMenu(lv); // Prepare the loader. Either re-connect with an existing one, // or start a new one. getLoaderManager().initLoader(0, null, this); lv.setVerticalFadingEdgeEnabled(true); } if (dualPane) { // In dual-pane mode, the list view highlights the selected item. Log.d("lp", "dual pane mode"); lv.setChoiceMode(ListView.CHOICE_MODE_SINGLE); // lv.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_LEFT); lv.setVerticalScrollBarEnabled(false); lv.setFadingEdgeLength(50); updateCheckedItem(); // Make sure our UI is in the correct state. // showDetails(curCheckPosition, curCheckWizard); } else { // getListView().setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_RIGHT); lv.setVerticalScrollBarEnabled(true); lv.setFadingEdgeLength(100); } }
@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 setListView() { /* * ArrayList<String> items = new ArrayList<String>(); for (int i = 0; i * < menuTitles.length; i++) { items.add(menuTitles[i]); } */ listView = (ListView) findViewById(R.id.menu_content_menulist); listView.setFadingEdgeLength(0); // ListView lv = (ListView)findViewById(R.id.listView); ArrayList<itemMenu> itemsCompra = obtenerItems(); itemMenuAdapter adapter = new itemMenuAdapter(this, itemsCompra); listView.setAdapter(adapter); /* * MenuAdapter menuAdapter = new MenuAdapter(this, items, this); * listView.setAdapter(menuAdapter); */ listView.setOnItemClickListener( new OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub setContent(arg2); sideSlideLayout.scroll(); } }); }
@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 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; }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); populate(); ListView lv = getListView(); lv.setFadingEdgeLength(3); lv.setScrollbarFadingEnabled(true); lv.setTextFilterEnabled(true); }
// 一列选择框 private void dialogRoommate( String title, final String key, final TextView textView, final List<String> list) { final AlertDialog.Builder builder = new AlertDialog.Builder(this); View view = View.inflate(ReleaseActivity.this, R.layout.dialog_addroommate, null); TextView textView_title = (TextView) view.findViewById(R.id.dialog_title1); textView_title.setText(title); ListView listView = (ListView) view.findViewById(R.id.dialog_listview); listView.setFadingEdgeLength(0); builder.setView(view); final Dialog dialog = builder.show(); listView.setAdapter(new ArrayAdapter<String>(this, R.layout.dialog_listview_layout, list)); listView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String str = list.get(position); textView.setText(str); dialog.dismiss(); } }); }
public void showAllGa2ooFriendsPopup() { LayoutInflater inflater = getLayoutInflater(); RelativeLayout popup = (RelativeLayout) inflater.inflate(R.layout.all_friends_popup, null); ImageView ivClose = (ImageView) popup.findViewById(R.id.ivClose); Button btnDone = (Button) popup.findViewById(R.id.btnDone); lvFriendsList = (ListView) popup.findViewById(R.id.lvFriendsList); lvFriendsList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); lvFriendsList.setCacheColorHint(0); lvFriendsList.setFadingEdgeLength(0); ivClose.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { customDialog.dismiss(); } }); vecFriends = new ArrayList<UserFriend>(); vecFriends.clear(); vecFriends = friendBL.getAllFriends(); if (vecFriends.size() != 0) { lvFriendsList.setAdapter(new CustomFriendAdapter(vecFriends)); } vctEmails.clear(); btnDone.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { for (int i = 0; i < vctEmails.size(); i++) { Log.i("Email", "" + vctEmails.get(i)); } customDialog.dismiss(); } }); customDialog = new PopUpDailog(getParent(), popup, LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); customDialog.show(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(LT, "App created."); Events.intEnableDebug(1); // disable the titlebar requestWindowFeature(Window.FEATURE_NO_TITLE); // create a basic user interface LinearLayout panel = new LinearLayout(this); panel.setOrientation(LinearLayout.VERTICAL); setContentView(panel); // -- Button b = new Button(this); b.setText("Scan Input Devs"); b.setId(idButScan); b.setOnClickListener(this); panel.addView(b); // -- m_lvDevices = new ListView(this); m_lvDevices.setLayoutParams( new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); m_lvDevices.setId(idLVDevices); m_lvDevices.setDividerHeight(0); m_lvDevices.setFadingEdgeLength(0); m_lvDevices.setCacheColorHint(0); m_lvDevices.setAdapter(null); panel.addView(m_lvDevices); // -- LinearLayout panelH = new LinearLayout(this); panelH.setOrientation(LinearLayout.HORIZONTAL); panel.addView(panelH); // -- m_selDevSpinner = new Spinner(this); m_selDevSpinner.setLayoutParams( new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); m_selDevSpinner.setId(idSelSpin); m_selDevSpinner.setOnItemSelectedListener((OnItemSelectedListener) this); panelH.addView(m_selDevSpinner); // -- simulate key event b = new Button(this); b.setText(">Key"); b.setId(idButInjectKey); b.setOnClickListener(this); panelH.addView(b); // -- simulate touch event b = new Button(this); b.setText(">Tch"); b.setId(idButInjectTouch); b.setOnClickListener(this); panelH.addView(b); // -- m_tvMonitor = new TextView(this); m_tvMonitor.setText("Event Monitor stopped."); panel.addView(m_tvMonitor); // -- panelH = new LinearLayout(this); panelH.setOrientation(LinearLayout.HORIZONTAL); panel.addView(panelH); // -- b = new Button(this); b.setText("Monitor Start"); b.setId(idButMonitorStart); b.setOnClickListener(this); panelH.addView(b); // -- b = new Button(this); b.setText("Monitor Stop"); b.setId(idButMonitorStop); b.setOnClickListener(this); panelH.addView(b); // -- simulate test event b = new Button(this); b.setText(">Test"); b.setId(idButTest); b.setOnClickListener(this); panelH.addView(b); }
@Override public View onCreateView() { LinearLayout ll_container = new LinearLayout(context); ll_container.setOrientation(LinearLayout.VERTICAL); ll_container.setBackgroundColor(Color.TRANSPARENT); /** title */ tv_title = new TextView(context); tv_title.setGravity(Gravity.CENTER); tv_title.setPadding(dp2px(10), dp2px(5), dp2px(10), dp2px(5)); LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); params.topMargin = dp2px(20); ll_container.addView(tv_title, params); /** title underline */ v_line_title = new View(context); ll_container.addView(v_line_title); /** listview */ lv = new ListView(context); lv.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 1)); lv.setCacheColorHint(Color.TRANSPARENT); lv.setFadingEdgeLength(0); lv.setVerticalScrollBarEnabled(false); lv.setSelector(new ColorDrawable(Color.TRANSPARENT)); ll_container.addView(lv); /** cancel btn */ tv_cancel = new TextView(context); tv_cancel.setGravity(Gravity.CENTER); LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.topMargin = dp2px(7); lp.bottomMargin = dp2px(7); tv_cancel.setLayoutParams(lp); ll_container.addView(tv_cancel); /** LayoutAnimation */ TranslateAnimation animation = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 6f, Animation.RELATIVE_TO_SELF, 0); animation.setInterpolator(new DecelerateInterpolator()); animation.setDuration(350); animation.setStartOffset(150); lac = new LayoutAnimationController(animation, 0.12f); lac.setInterpolator(new DecelerateInterpolator()); return ll_container; }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.showall); b = getIntent().getExtras(); listItemss = b.getStringArray("list"); imagess = b.getIntArray("image"); data = b.getStringArray("data"); listview = (ListView) findViewById(R.id.listView1); listview.setScrollingCacheEnabled(false); listview.setDividerHeight(0); listview.setCacheColorHint(R.color.blue); listview.setFadingEdgeLength(0); search = (EditText) findViewById(R.id.search); search.setHint("Filter Result"); search.setSelected(false); search.addTextChangedListener( new TextWatcher() { @Override public void afterTextChanged(Editable s) { // TODO Auto-generated method stub } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {} @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if (search.getText().toString().trim().length() == 0) { listview.setAdapter( new ImageAdapter( ShowAll.this, R.layout.clistview, R.id.text1, R.id.image1, b.getStringArray("list"), b.getIntArray("image"), b.getStringArray("data"), 1)); } else { int newcount = 0; for (int i = 0; i < listItemss.length; i++) { try { String temp = listItemss[i].toLowerCase(); String tempsearch = search.getText().toString().toLowerCase(); if (temp.contains(tempsearch)) { newcount++; } } catch (Exception e) { System.out.println(e.toString()); } } String[] newlist = new String[newcount]; String[] newdata = new String[newcount]; newcount = 0; for (int i = 0; i < listItemss.length; i++) { try { String temp = listItemss[i].toLowerCase(); String tempsearch = search.getText().toString().toLowerCase(); if (temp.contains(tempsearch)) { newlist[newcount] = listItemss[i]; newdata[newcount] = data[i]; newcount++; } } catch (Exception e) { System.out.println(e.toString()); } } // listview.setAdapter(new ImageAdapter(ShowAll.this, // R.layout.clistview, R.id.text1, R.id.image1,newlist // ,Arrays.copyOf(imagess, newcount),newdata ,1 )); } } }); new ProgressTask().execute(); }