當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。