当前位置: 首页>>代码示例>>Java>>正文


Java ListView.setDividerHeight方法代码示例

本文整理汇总了Java中android.widget.ListView.setDividerHeight方法的典型用法代码示例。如果您正苦于以下问题:Java ListView.setDividerHeight方法的具体用法?Java ListView.setDividerHeight怎么用?Java ListView.setDividerHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.ListView的用法示例。


在下文中一共展示了ListView.setDividerHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SearchableSpinner

import android.widget.ListView; //导入方法依赖的package包/类
public SearchableSpinner(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) {
    super(context, attrs, defStyleAttr, defStyleRes);
    mContext = context;
    getAttributeSet(attrs, defStyleAttr, defStyleRes);

    final LayoutInflater factory = LayoutInflater.from(context);
    factory.inflate(R.layout.view_searchable_spinner, this, true);

    mSpinnerListContainer = (LinearLayout) factory.inflate(R.layout.view_list, this, false);
    mSpinnerListView = (ListView) mSpinnerListContainer.findViewById(R.id.LstVw_SpinnerListView);
    if (mListItemDivider != null) {
        mSpinnerListView.setDivider(mListItemDivider);
        mSpinnerListView.setDividerHeight(mListDividerSize);
    }
    mEmptyTextView = (TextView) mSpinnerListContainer.findViewById(R.id.TxtVw_EmptyText);
    mSpinnerListView.setEmptyView(mEmptyTextView);
}
 
开发者ID:michaelprimez,项目名称:searchablespinner,代码行数:18,代码来源:SearchableSpinner.java

示例2: onCreate

import android.widget.ListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    AdapterAndroidVersion adapterAndroidVersion = new AdapterAndroidVersion(this, 0, getAndroidVer());

    ListView listView = findViewById(R.id.mainList);
    listView.setDividerHeight(0);
    listView.setAdapter(adapterAndroidVersion);
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {

            ModelAndroidVersion androidVersion = getAndroidVer().get(i);
            Snackbar.make(findViewById(R.id.rootView), androidVersion.codeName, Snackbar.LENGTH_SHORT).show();

        }
    });
}
 
开发者ID:alfianyusufabdullah,项目名称:android-example,代码行数:21,代码来源:MainActivity.java

示例3: makeCenterView

import android.widget.ListView; //导入方法依赖的package包/类
@Override
@NonNull
protected LinearLayout makeCenterView() {
    LinearLayout rootLayout = new LinearLayout(activity);
    rootLayout.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
    rootLayout.setBackgroundColor(Color.WHITE);
    rootLayout.setOrientation(LinearLayout.VERTICAL);
    ListView listView = new ListView(activity);
    listView.setBackgroundColor(Color.WHITE);
    listView.setDivider(new ColorDrawable(0xFFDDDDDD));
    listView.setDividerHeight(1);
    listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    listView.setSelector(R.color.itemSelected);
    listView.setCacheColorHint(Color.TRANSPARENT);
    listView.setLayoutParams(new ViewGroup.LayoutParams(MATCH_PARENT, WRAP_CONTENT));
    listView.setAdapter(adapter);
    listView.setOnItemClickListener(this);
    rootLayout.addView(listView);
    return rootLayout;
}
 
开发者ID:mainh,项目名称:MainCalendar,代码行数:21,代码来源:FilePicker.java

示例4: onCreateView

import android.widget.ListView; //导入方法依赖的package包/类
@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);
}
 
开发者ID:willowtreeapps,项目名称:spruce-android,代码行数:27,代码来源:ListViewFragment.java

示例5: findViews

import android.widget.ListView; //导入方法依赖的package包/类
@Override
protected void findViews() {
    lv = (ListView) rootView.findViewById(R.id.lv);

    lv.setDivider(new ColorDrawable(lv.getResources().getColor(R.color.line_dd)));
    lv.setDividerHeight(1);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:IosCenterItemHolder.java

示例6: findViews

import android.widget.ListView; //导入方法依赖的package包/类
@Override
protected void findViews() {
    lv = (ListView) rootView.findViewById(R.id.lv);

    lv.setDivider(new ColorDrawable(lv.getResources().getColor(R.color.line_dd)));
    lv.setDividerHeight(1);
    btnBottom = (Button) rootView.findViewById(R.id.btn_bottom);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:IosActionSheetHolder.java

示例7: onCreateView

import android.widget.ListView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	context = getActivity().getApplicationContext();
	RelativeLayout playLayout = new RelativeLayout(context);
	playLayout.setBackgroundColor(Color.WHITE);
	LayoutParams playLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	playLayout.setLayoutParams(playLayoutParams);
	
	playListView = new ListView(context);
	playListView.setDivider(getResources().getDrawable(R.drawable.line));
	playListView.setDividerHeight(2);
	playListView.setPadding(10, 10, 10, 10);
	LayoutParams playListLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	playLayout.addView(playListView, playListLayoutParams);

	// 生成动态数组,加入数据
	pairs = new ArrayList<Pair<String,Integer>>();
	for (int i = 0; i < playVideoIds.length; i++) {
		Pair<String, Integer> pair = new Pair<String, Integer>(playVideoIds[i], R.drawable.play);
		pairs.add(pair);
	}

	videoListViewAdapter = new VideoListViewAdapter(context, pairs);
	playListView.setAdapter(videoListViewAdapter);
	playListView.setOnItemClickListener(onItemClickListener);

	return playLayout;
}
 
开发者ID:lbbniu,项目名称:CCDownload,代码行数:29,代码来源:PlayFragment.java

示例8: setMiniSpacing

import android.widget.ListView; //导入方法依赖的package包/类
/**
 * 设置分隔条高度
 *
 * @param height
 * @return
 */
@Override
public UDBaseListOrRecyclerView setMiniSpacing(int height) {
    final ListView lv = getListView();
    if (lv != null && height >= 0) {
        lv.setDividerHeight(height);
    }
    return this;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:15,代码来源:UDBaseListView.java

示例9: QDQQFaceBasePagerView

import android.widget.ListView; //导入方法依赖的package包/类
public QDQQFaceBasePagerView(Context context) {
    super(context);

    mTestData = new QDQQFaceTestData();

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

    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);
}
 
开发者ID:coopese,项目名称:qmui,代码行数:28,代码来源:QDQQFaceBasePagerView.java

示例10: makeCenterView

import android.widget.ListView; //导入方法依赖的package包/类
@Override
@NonNull
protected LinearLayout makeCenterView() {
    LinearLayout rootLayout = new LinearLayout(activity);
    rootLayout.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
    rootLayout.setOrientation(LinearLayout.VERTICAL);

    mListView = new ListView(activity);
    mListView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
    mListView.getLayoutParams().height = screenHeightPixels/4;
    mListView.setPadding(30, 10, 30, 10);
    // 去掉分割线
    mListView.setDividerHeight(0);
    mListView.setAdapter(mWeekAdapter);
    rootLayout.addView(mListView);

    mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1,
                                int arg2, long arg3) {
            // 取得ViewHolder对象,这样就省去了通过层层的findViewById去实例化我们需要的cb实例的步骤
            WeekAdapter.ViewHolder holder = (WeekAdapter.ViewHolder) arg1.getTag();
            // 改变CheckBox的状态
            holder.cb.toggle();
            // 将CheckBox的选中状况记录下来
            mWeekAdapter.setIsSelected(arg2, holder.cb.isChecked());
        }
    });
    setTitleText(mTitle);
    return rootLayout;
}
 
开发者ID:mainh,项目名称:MainCalendar,代码行数:32,代码来源:WeekPicker.java

示例11: onCreateDialog

import android.widget.ListView; //导入方法依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View v = inflater.inflate(R.layout.sync_passphrase_types, null);

    // Configure the passphrase type list
    ListView list = (ListView) v.findViewById(R.id.passphrase_types);
    Adapter adapter = createAdapter(getCurrentTypeFromArguments());
    list.setAdapter(adapter);
    list.setId(R.id.passphrase_type_list);
    list.setOnItemClickListener(this);
    list.setDividerHeight(0);
    PassphraseType currentType = getCurrentTypeFromArguments();
    list.setSelection(adapter.getPositionForType(currentType));

    // Configure the hint to reset the passphrase settings
    // Only show this hint if encryption has been set to use sync passphrase
    if (currentType == PassphraseType.CUSTOM_PASSPHRASE) {
        TextView instructionsView = (TextView) v.findViewById(R.id.reset_sync_text);
        instructionsView.setVisibility(View.VISIBLE);
        instructionsView.setMovementMethod(LinkMovementMethod.getInstance());
        instructionsView.setText(getResetText());
    }

    // Create and return the dialog
    return new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme)
            .setNegativeButton(R.string.cancel, this)
            .setTitle(R.string.sync_passphrase_type_title)
            .setView(v)
            .create();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:32,代码来源:PassphraseTypeDialogFragment.java

示例12: SlideMenuView

import android.widget.ListView; //导入方法依赖的package包/类
public SlideMenuView(Context context) {
    super(context);
    
    mListView = new ListView(context);
    mListView.setCacheColorHint(0);
    mListView.setDividerHeight(0);
    mListView.setDivider(new ColorDrawable(Color.TRANSPARENT));
    mListView.setVerticalScrollBarEnabled(false);
    mListView.setOnItemClickListener(mListItemClickListener);
    addView(mListView);
}
 
开发者ID:suomenriistakeskus,项目名称:oma-riista-android,代码行数:12,代码来源:SlideMenu.java

示例13: QDQQFaceBasePagerView

import android.widget.ListView; //导入方法依赖的package包/类
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);
}
 
开发者ID:QMUI,项目名称:QMUI_Android,代码行数:28,代码来源:QDQQFaceBasePagerView.java

示例14: apply

import android.widget.ListView; //导入方法依赖的package包/类
@Override
public void apply(View view) {
	if(view instanceof ListView){
		ListView tv = (ListView)view;
		if(RES_TYPE_NAME_COLOR.equals(attrValueTypeName)){
			int color = SkinManager.getInstance().getColor(attrValueRefId);
			ColorDrawable sage = new ColorDrawable(color);
			tv.setDivider(sage);
			tv.setDividerHeight(dividerHeight);
		}else if(RES_TYPE_NAME_DRAWABLE.equals(attrValueTypeName)){
			tv.setDivider(SkinManager.getInstance().getDrawable(attrValueRefId));
		}
	}
}
 
开发者ID:stven0king,项目名称:Android-Skin-Loader,代码行数:15,代码来源:DividerAttr.java

示例15: onCreate

import android.widget.ListView; //导入方法依赖的package包/类
@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);
        }
    });
}
 
开发者ID:Ramotion,项目名称:showroom-android,代码行数:77,代码来源:ExpandingCollectionActivity.java


注:本文中的android.widget.ListView.setDividerHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。