Java Code Examples for android.widget.ListView.setDivider()

The following are Jave code examples for showing how to use setDivider() of the android.widget.ListView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: SmartButler   File: ButlerFragment.java   View Source Code Vote up 9 votes
private void initView(View view)
{
    lv_chatting= (ListView) view.findViewById(R.id.lv_chatting);
    btn_chatting_send= (Button) view.findViewById(R.id.btn_chatting_send);
    et_chatting_text= (EditText) view.findViewById(R.id.et_chatting_text);

    //适配器初始化以及与ListView的绑定
    adapter=new ChattingAdapter(mList);
    lv_chatting.setAdapter(adapter);
    //取消ListView的分割线
    lv_chatting.setDivider(null);
    //机器人欢迎话语
    showButlerResponse("你好,人家是向玮鑫的小管家啦~");

    btn_chatting_send.setOnClickListener(this);
    et_chatting_text.setOnClickListener(this);
}
 
Example 2
Project: spruce-android   File: ListViewFragment.java   View Source Code Vote up 6 votes
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, @Nullable Bundle savedInstanceState) {
    listView = (ListView) container.findViewById(R.id.list_view);

    // Create the animator after the list view has finished laying out
    listView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            initSpruce();
        }
    });

    // Mock data objects
    List<ExampleData> placeHolderList = new ArrayList<>();
    for (int i = 0; i < 10; i++) {
        placeHolderList.add(new ExampleData());
    }

    // Remove default dividers and set adapter
    listView.setDivider(null);
    listView.setDividerHeight(0);
    listView.setAdapter(new ListViewAdapter(placeHolderList));

    return inflater.inflate(R.layout.list_view_fragment, container, false);
}
 
Example 3
Project: simple-share-android   File: DirectoryFragment.java   View Source Code Vote up 6 votes
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	final Context context = inflater.getContext();
       final Resources res = context.getResources();
	final View view = inflater.inflate(R.layout.fragment_directory, container, false);

       mProgressBar = (MaterialProgressBar) view.findViewById(R.id.progressBar);

	mEmptyView = (CompatTextView)view.findViewById(android.R.id.empty);

	mListView = (ListView) view.findViewById(R.id.list);
	mListView.setOnItemClickListener(mItemListener);
	mListView.setMultiChoiceModeListener(mMultiListener);
	mListView.setRecyclerListener(mRecycleListener);

       // Indent our list divider to align with text
       final Drawable divider = mListView.getDivider();
       final boolean insetLeft = res.getBoolean(R.bool.list_divider_inset_left);
       final int insetSize = res.getDimensionPixelSize(R.dimen.list_divider_inset);
       if (insetLeft) {
           mListView.setDivider(new InsetDrawable(divider, insetSize, 0, 0, 0));
       } else {
           mListView.setDivider(new InsetDrawable(divider, 0, 0, insetSize, 0));
       }

	mGridView = (GridView) view.findViewById(R.id.grid);
	mGridView.setOnItemClickListener(mItemListener);
	mGridView.setMultiChoiceModeListener(mMultiListener);
	mGridView.setRecyclerListener(mRecycleListener);

	return view;
}
 
Example 4
Project: chromium-for-android-56-debug-video   File: UsbDevicePreferences.java   View Source Code Vote up 6 votes
@Override
@SuppressWarnings("unchecked")
public void onActivityCreated(Bundle savedInstanceState) {
    addPreferencesFromResource(R.xml.usb_device_preferences);
    ListView listView = (ListView) getView().findViewById(android.R.id.list);
    listView.setDivider(null);

    int contentSettingsType = getArguments().getInt(EXTRA_CATEGORY);
    mCategory = SiteSettingsCategory.fromContentSettingsType(contentSettingsType);
    mUsbInfos = (ArrayList<UsbInfo>) getArguments().getSerializable(EXTRA_USB_INFOS);
    mUsbInfo = mUsbInfos.get(0);
    mSites = (ArrayList<Website>) getArguments().getSerializable(EXTRA_SITES);
    String title = getArguments().getString(SingleCategoryPreferences.EXTRA_TITLE);
    if (title != null) getActivity().setTitle(title);

    setHasOptionsMenu(true);

    super.onActivityCreated(savedInstanceState);
}
 
Example 5
Project: Swap   File: SearchFragment.java   View Source Code Vote up 6 votes
private void initv() {

        List<Data> count=DataSupport.select().find(Data.class);
        int counts=count.size();
        if (counts>0){
            Data lastData= DataSupport.findLast(Data.class);
            int last=lastData.getId();
            if (last>5){
                recent=DataSupport.limit(5).offset(last-5).find(Data.class);
            }
            else {
                recent=DataSupport.findAll(Data.class);
            }
        }

        final SearchRecentAdapter adapter=new SearchRecentAdapter(getActivity(),R.layout.hot_item,recent);
        ListView listView= (ListView) rootView.findViewById(R.id.recent_view);
        listView.setDivider(null);
        listView.setAdapter(adapter);

    }
 
Example 6
Project: GitHub   File: MultiItemListViewActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);


    mListView = (ListView) findViewById(R.id.id_listview_list);
    mListView.setDivider(null);
    mListView.setAdapter(new ChatAdapter(this, ChatMessage.MOCK_DATAS));

}
 
Example 7
Project: OSchina_resources_android   File: CommonDialog.java   View Source Code Vote up 5 votes
public void setItems(CharSequence[] items, int index,
                     AdapterView.OnItemClickListener onItemClickListener) {
    ListView listview = new ListView(content.getContext());
    listview.setCacheColorHint(0);
    listview.setDivider(null);
    listview.setLayoutParams(new FrameLayout.LayoutParams(
            LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    listview.setAdapter(new DialogAdapter(items, index));
    listview.setOnItemClickListener(onItemClickListener);
    setContent(listview, 0);
}
 
Example 8
Project: QMUI_Android   File: QDQQFaceBasePagerView.java   View Source Code Vote up 5 votes
public QDQQFaceBasePagerView(Context context) {
    super(context);

    mTestData = new QDQQFaceTestData();

    setOrientation(VERTICAL);
    ListView listView = new ListView(context);
    LinearLayout.LayoutParams listLp = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0);
    listLp.weight = 1;
    listView.setLayoutParams(listLp);
    listView.setDivider(null);
    listView.setDividerHeight(0);
    listView.setAdapter(new MyAdapter());
    addView(listView);

    mLogTv = new TextView(context);
    LinearLayout.LayoutParams logLp = new LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, QMUIDisplayHelper.dp2px(context, 60));
    mLogTv.setLayoutParams(logLp);
    mLogTv.setTextSize(12);
    mLogTv.setBackgroundResource(R.drawable.qmui_divider_top_bitmap);
    int paddingHor = QMUIDisplayHelper.dp2px(context, 16);
    mLogTv.setPadding(paddingHor, 0, paddingHor, 0);
    mLogTv.setTextColor(ContextCompat.getColor(context, R.color.qmui_config_color_black));
    mLogTv.setMovementMethod(QMUIScrollingMovementMethod.getInstance());
    addView(mLogTv);
}
 
Example 9
Project: SetupWizardLibCompat   File: SetupWizardListLayout.java   View Source Code Vote up 5 votes
private void updateDivider() {
    boolean shouldUpdate = true;
    if (Build.VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
        shouldUpdate = isLayoutDirectionResolved();
    }
    if (shouldUpdate) {
        final ListView listView = getListView();
        if (mDefaultDivider == null) {
            mDefaultDivider = listView.getDivider();
        }
        mDivider = DrawableLayoutDirectionHelper.createRelativeInsetDrawable(mDefaultDivider,
                mDividerInset /* start */, 0 /* top */, 0 /* end */, 0 /* bottom */, this);
        listView.setDivider(mDivider);
    }
}
 
Example 10
Project: CCDownload   File: DownloadFragment.java   View Source Code Vote up 5 votes
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	activity = getActivity();
	context = activity.getApplicationContext();
	receiver = new DownloadedReceiver();
	activity.registerReceiver(receiver, new IntentFilter(ConfigUtil.ACTION_DOWNLOADING));
	
	RelativeLayout downloadRelativeLayout = new RelativeLayout(context);
	downloadRelativeLayout.setBackgroundColor(Color.WHITE);
	downloadRelativeLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	
	downloadListView = new ListView(context);
	downloadListView.setPadding(10, 10, 10, 10);
	downloadListView.setDivider(getResources().getDrawable(R.drawable.line));
	LayoutParams listViewLayout = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	downloadRelativeLayout.addView(downloadListView, listViewLayout);
	
	// 生成动态数组,加入数据
	pairs = new ArrayList<Pair<String,Integer>>();
	for (int i = 0; i < downloadVideoIds.length; i++) {
		Pair<String, Integer> pair = new Pair<String, Integer>(downloadVideoIds[i], R.drawable.download);
		pairs.add(pair);
	}

	downloadListViewAdapter = new DownloadListViewAdapter(context, pairs);
	downloadListView.setAdapter(downloadListViewAdapter);
	downloadListView.setOnItemClickListener(onItemClickListener);

	service = new Intent(context, DownloadService.class);
	activity.bindService(service, serviceConnection, Context.BIND_AUTO_CREATE);
	
	initDownloaderHashMap();
	
	return downloadRelativeLayout;
}
 
Example 11
Project: BaseAdapterRel   File: MultiItemListViewActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);


    mListView = (ListView) findViewById(R.id.id_listview_list);
    mListView.setDivider(null);
    mListView.setAdapter(new ChatAdapter(this, ChatMessage.MOCK_DATAS));
}
 
Example 12
Project: OSchina_resources_android   File: CommonDialog.java   View Source Code Vote up 5 votes
public void setItemsWithoutChk(CharSequence[] items,
                               AdapterView.OnItemClickListener onItemClickListener) {
    ListView listview = new ListView(content.getContext());
    listview.setLayoutParams(new FrameLayout.LayoutParams(-1, -2));
    DialogAdapter adapter = new DialogAdapter(items);
    adapter.setShowChk(false);
    listview.setDivider(null);
    listview.setAdapter(adapter);
    listview.setOnItemClickListener(onItemClickListener);
    setContent(listview, 0);
}
 
Example 13
Project: QMUI_Android   File: QMUIListPopup.java   View Source Code Vote up 5 votes
public void create(int width, int maxHeight, AdapterView.OnItemClickListener onItemClickListener) {
    ListView listView = new QMUIWrapContentListView(mContext, maxHeight);
    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(width, maxHeight);
    listView.setLayoutParams(lp);
    listView.setAdapter(mAdapter);
    listView.setVerticalScrollBarEnabled(false);
    listView.setOnItemClickListener(onItemClickListener);
    listView.setDivider(null);
    setContentView(listView);
}
 
Example 14
Project: SetupWizardLibCompat   File: GlifListLayout.java   View Source Code Vote up 5 votes
private void updateDivider() {
    boolean shouldUpdate = true;
    if (Build.VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
        shouldUpdate = isLayoutDirectionResolved();
    }
    if (shouldUpdate) {
        final ListView listView = getListView();
        if (mDefaultDivider == null) {
            mDefaultDivider = listView.getDivider();
        }
        mDivider = DrawableLayoutDirectionHelper.createRelativeInsetDrawable(mDefaultDivider,
                mDividerInset /* start */, 0 /* top */, 0 /* end */, 0 /* bottom */, this);
        listView.setDivider(mDivider);
    }
}
 
Example 15
Project: grid-video-viewer   File: VideoGridFragment.java   View Source Code Vote up 5 votes
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    Bundle args = this.getArguments();

    mColCount = args.getInt(GalleryActivity.EXT_COL_COUNT, 2);
    int playCount = args.getInt(GalleryActivity.EXT_PLAY_COUNT, 1);
    mTapAction = args.getInt(GalleryActivity.EXT_TAP_ACTION, MainActivity.TAP_ACTION_FLOAT);

    Context context = getActivity().getApplicationContext();
    mWindowSize = new int[2];
    DisplayMetrics display = context.getResources().getDisplayMetrics();
    mWindowSize[0] = display.widthPixels;
    mWindowSize[1] = display.heightPixels;

    mRootView = new RelativeLayout(context);
    RelativeLayout.LayoutParams listLayoutParams = new RelativeLayout.LayoutParams(
            LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

    mVideoList = new ListView(context);
    mVideoList.setDivider(null);

    mRootView.addView(mVideoList, listLayoutParams);

    mVideoUriList = new ArrayList<>();
    mThumbnailCache = new ThumbnailCache(context);
    mSurfaceArray = new SparseArray<>();

    mQueueManager.setMaxRunCount(playCount);

    return mRootView;
}
 
Example 16
Project: chromium-for-android-56-debug-video   File: SearchEnginePreference.java   View Source Code Vote up 5 votes
@Override
public View onCreateView(
        LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.search_engine_layout, container, false);
    mListView = (ListView) view.findViewById(android.R.id.list);
    mListView.setAdapter(mSearchEngineAdapter);
    mListView.setDivider(null);
    mListView.addOnLayoutChangeListener(this);
    mCancelButton = view.findViewById(R.id.cancel_button);
    mCancelButton.setOnClickListener(this);
    mSaveButton = view.findViewById(R.id.save_button);
    mSaveButton.setOnClickListener(this);
    mDivider = view.findViewById(R.id.bottom_shadow);
    return view;
}
 
Example 17
Project: FireFiles   File: ConnectionsFragment.java   View Source Code Vote up 5 votes
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    final Resources res = getActivity().getResources();

    fab = (FloatingActionButton)view.findViewById(R.id.fab);
    fab.setOnClickListener(this);
    if(isTelevision()){
        fab.setVisibility(View.GONE);
    }

    mProgressBar = (MaterialProgressBar) view.findViewById(R.id.progressBar);
    mEmptyView = (CompatTextView)view.findViewById(android.R.id.empty);
    mListView = (ListView) view.findViewById(R.id.list);
    mListView.setOnItemClickListener(mItemListener);
    if(isTelevision()) {
        mListView.setOnItemLongClickListener(mItemLongClickListener);
    }
    fab.attachToListView(mListView);

    // Indent our list divider to align with text
    final Drawable divider = mListView.getDivider();
    final boolean insetLeft = res.getBoolean(R.bool.list_divider_inset_left);
    final int insetSize = res.getDimensionPixelSize(R.dimen.list_divider_inset);
    if (insetLeft) {
        mListView.setDivider(new InsetDrawable(divider, insetSize, 0, 0, 0));
    } else {
        mListView.setDivider(new InsetDrawable(divider, 0, 0, insetSize, 0));
    }
}
 
Example 18
Project: showroom-android   File: ExpandingCollectionActivity.java   View Source Code Vote up 4 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Make activity fullscreen
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    ActionBar supportActionBar = getSupportActionBar();
    if (null != supportActionBar)
        supportActionBar.hide();

    setContentView(R.layout.ec_main_activity);

    // Create adapter for pager
    ECPagerViewAdapter adapter = new ECPagerViewAdapter(this, new ExampleDataset().getDataset()) {
        @Override
        public void instantiateCard(LayoutInflater inflaterService, ViewGroup head, ListView list, final ECCardData data) {
            final CardData cardData = (CardData) data;

            // Create adapter for list inside a card and set adapter to card content
            CommentArrayAdapter commentArrayAdapter = new CommentArrayAdapter(getApplicationContext(), cardData.getListItems());
            list.setAdapter(commentArrayAdapter);
            list.setDivider(getResources().getDrawable(R.drawable.ec_list_divider));
            list.setDividerHeight((int) pxFromDp(getApplicationContext(), 0.5f));
            list.setSelector(R.color.ec_transparent);
            list.setBackgroundColor(Color.WHITE);
            list.setCacheColorHint(Color.TRANSPARENT);

            // Add gradient to root header view
            View gradient = new View(getApplicationContext());
            gradient.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, AbsListView.LayoutParams.MATCH_PARENT));
            gradient.setBackgroundDrawable(getResources().getDrawable(R.drawable.ec_card_head_gradient));
            head.addView(gradient);

            // Inflate main header layout and attach it to header root view
            inflaterService.inflate(R.layout.ec_simple_head, head);

            // Set header data from data object
            TextView title = (TextView) head.findViewById(R.id.ec_title);
            title.setText(cardData.getHeadTitle());
            ImageView avatar = (ImageView) head.findViewById(R.id.ec_avatar);
            avatar.setImageResource(cardData.getPersonPictureResource());
            TextView name = (TextView) head.findViewById(R.id.ec_name);
            name.setText(cardData.getPersonName() + ":");
            TextView message = (TextView) head.findViewById(R.id.ec_message);
            message.setText(cardData.getPersonMessage());
            TextView viewsCount = (TextView) head.findViewById(R.id.ec_social_views_count);
            viewsCount.setText(" " + cardData.getPersonViewsCount());
            TextView likesCount = (TextView) head.findViewById(R.id.ec_social_likes_count);
            likesCount.setText(" " + cardData.getPersonLikesCount());
            TextView commentsCount = (TextView) head.findViewById(R.id.ec_social_comments_count);
            commentsCount.setText(" " + cardData.getPersonCommentsCount());

            // Add onclick listener to card header for toggle card state
            head.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(final View v) {
                    ecPagerView.toggle();
                }
            });
        }
    };

    ecPagerView = (ECPagerView) findViewById(R.id.ec_pager_element);

    ecPagerView.setPagerViewAdapter(adapter);
    ecPagerView.setBackgroundSwitcherView((ECBackgroundSwitcherView) findViewById(R.id.ec_bg_switcher_element));

    final ItemsCountView itemsCountView = (ItemsCountView) findViewById(R.id.ec_items_count_view);
    ecPagerView.setOnCardSelectedListener(new ECPagerView.OnCardSelectedListener() {
        @Override
        public void cardSelected(int newPosition, int oldPosition, int totalElements) {
            itemsCountView.update(newPosition, oldPosition, totalElements);
        }
    });
}
 
Example 19
Project: Android-Music-Player   File: popupList.java   View Source Code Vote up 4 votes
public popupList(Context context, int width, int height) {
    super(context, width, height);
    setBackgroundColor(0x66000000);

    sl = new FMlyt(getContext(), Ui.cd.getHt(200), Ui.cd.getHt(300)){};
    sl.setBackgroundColor(0x00000000);
    sl.InCenter(width,height);

    rs = new radiusSqure(sl.width  - Ui.cd.getHt(4),sl.height - Ui.cd.getHt(4),0,0, Ui.cd.getHt(13));
    rs.setColor(popupBack.Color0);
   // addShape(rs);

    rb = new radiusBorder(sl.width,sl.height,0,0, Ui.cd.getHt(2), Ui.cd.getHt(13));
    rb.setColor(savebtnRingColor.Color0);
    sl.addShape(rb);

    presetAdapter data;
    listview = new ListView(getContext()){
        @Override
        protected void onDraw(Canvas canvas) {
            canvas.clipPath(rs.S0);
            super.onDraw(canvas);
        }
    };
    listview.setLayoutParams(new FrameLayout.LayoutParams( sl.width - Ui.cd.getHt(4), sl.height - Ui.cd.getHt(4)));

    listview.setDivider(null);
    listview.setX(Ui.cd.getHt(2));
    listview.setY(Ui.cd.getHt(2));
    listview.setBackgroundResource(0);
    //listview.setBackgroundColor(com.shape.home.slider.backgroundImg.Color0);
    data = new presetAdapter(){

        @Override
        public int getHeigtht() {
            return sl.width - Ui.cd.getHt(4);
        }

        @Override
        public void onReload(){
            if(listview != null){
                Ui.bk.back();
                popupList.this.onReload();
            }
        }
    };
    listview.setAdapter(data);
    sl.addView(listview);
    addView(sl);
}
 
Example 20
Project: PlusGram   File: ThemStore.java   View Source Code Vote up 4 votes
@Override
public View createView(final Context context) {
    actionBar.setBackgroundColor(Theme.ACTION_BAR_MEDIA_PICKER_COLOR);
    actionBar.setItemsBackgroundColor(Theme.ACTION_BAR_PICKER_SELECTOR_COLOR);
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(true);
    actionBar.setTitle(LocaleController.getString("ThemeStore", R.string.ThemeStore));
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            }
        }
    });


    fragmentView = new FrameLayout(context);
    fragmentView.setLayoutParams(new FrameLayout.LayoutParams(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));


    FrameLayout frameLayout = (FrameLayout) fragmentView;


    listView = new ListView(context);

    SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences(AndroidUtilities.THEME_PREFS, AndroidUtilities.THEME_PREFS_MODE);
    listView.setBackgroundColor(preferences.getInt("prefBGColor", 0xffffffff));
    listView.setDivider(null);
    listView.setDividerHeight(0);
    listView.setVerticalScrollBarEnabled(false);
    int def = preferences.getInt("themeColor", AndroidUtilities.defColor);
    int hColor = preferences.getInt("prefHeaderColor", def);
    AndroidUtilities.setListViewEdgeEffectColor(listView, /*AvatarDrawable.getProfileBackColorForId(5)*/ hColor);
    frameLayout.addView(listView);
    FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams();
    layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT;
    layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT;
    layoutParams.gravity = Gravity.TOP;
    listView.setLayoutParams(layoutParams);

    progressDialog = new ProgressDialog(context);
    progressDialog.setCanceledOnTouchOutside(false);
    progressDialog.setMessage(context.getString(R.string.Loading));

    if (Cashing.themes.size() < 1) {
        progressDialog.show();
        new getThemes(context, constant.GET_THEMES).execute();
    } else {
        themes = Cashing.themes;
        refreshDisplay(context);
    }

    return fragmentView;
}