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


Java ListView.setSelector方法代码示例

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


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

示例1: 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

示例2: FileListView

import android.widget.ListView; //导入方法依赖的package包/类
FileListView(Commander c)
{
    commander = c;
    listView = (ListView) commander.findViewById(R.id.fman_list_view);
    listView.setItemsCanFocus(false);
    listView.setFocusableInTouchMode(true);
    listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
    listView.setOnItemClickListener(this);
    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
    {
        TypedValue outValue = new TypedValue();
        commander.getContext().getTheme().resolveAttribute(R.attr.selectableItemBackground, outValue, true);
        listView.setSelector(outValue.resourceId);
    }
    commander.registerForContextMenu(listView);
    statusPanel = (LinearLayout) commander.findViewById(R.id.fman_status_panel);
    statusPanelDivider = commander.findViewById(R.id.fman_status_panel_divider);
    statusBar = (TextView) commander.findViewById(R.id.fman_status_bar);
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:20,代码来源:FileListView.java

示例3: onCreateView

import android.widget.ListView; //导入方法依赖的package包/类
@Override
public View onCreateView() {
    LinearLayout ll_container = new LinearLayout(context);
    ll_container.setOrientation(LinearLayout.VERTICAL);

    /** title */
    tv_title = new TextView(context);
    tv_title.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));
    tv_title.setSingleLine(true);
    tv_title.setPadding(dp2px(18), dp2px(10), 0, dp2px(10));

    ll_container.addView(tv_title);

    /** listview */
    lv = new ListView(context);
    lv.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));
    lv.setCacheColorHint(Color.TRANSPARENT);
    lv.setFadingEdgeLength(0);
    lv.setVerticalScrollBarEnabled(false);
    lv.setSelector(new ColorDrawable(Color.TRANSPARENT));

    ll_container.addView(lv);

    return ll_container;
}
 
开发者ID:Luodian,项目名称:Shared-Route,代码行数:28,代码来源:NormalListDialog.java

示例4: 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

示例5: onCreate

import android.widget.ListView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle icicle) {
    if (DBG) Log.d(TAG, "onCreate");
    super.onCreate(icicle);

    setContentView(R.layout.subtitles_wizard_main);

    // Extract the path of the video to handle from the intent
    Uri videoUri = getIntent().getData();
    // FIXME: this is broken for smb:// files
    if (videoUri != null) {
        mVideoUri = videoUri;
        mVideoPath = videoUri.getPath();
        if (DBG) Log.d(TAG, "onCreate : video to process = " + mVideoPath);

        if (mVideoPath != null) {
            File videoFile = new File(mVideoPath);

            // Retrieve the list of subtitles files already associated with the video
            mCurrentFilesCount = buildCurrentSubtitlesFilesList(mVideoPath);
            if (DBG) Log.d(TAG, "onCreate : mCurrentFilesCount = " + mCurrentFilesCount);

            // Get the list of subtitles files available in the current folder
            mAvailableFilesCount = buildAvailableSubtitlesFilesList(videoFile.getParent());
            if (DBG) Log.d(TAG, "onCreate : mAvailableFilesCount = " + mAvailableFilesCount);
        }
    }
    else {
        // Bad intent
        Log.e(TAG, "onCreate error : no folder provided");
        mVideoUri = null;
    }

    // Use the name of the video to build the help message displayed at the top of the screen
    TextView helpMessageHeader = (TextView) findViewById(R.id.help_message_header);
    String name = Utils.getFileNameWithoutExtension(mVideoUri);

    String helpMessage;
    if (mAvailableFilesCount == 0 && mCurrentFilesCount == 0) {
        helpMessage = getString(R.string.subtitles_wizard_empty_list_help).replace("%s", name);
    }
    else {
        helpMessage = getString(R.string.subtitles_wizard_help).replace("%s", name);
    }
    helpMessageHeader.setText(helpMessage);

    // Inflate the view to show if no subtitles files are found
    mEmptyView = (TextView) LayoutInflater.from(this).inflate(R.layout.browser_empty_item, null);

    mListView = (ListView) findViewById(R.id.list_items);
    mListView.setEmptyView(mEmptyView);

    SubtitlesWizardAdapter adapter = new SubtitlesWizardAdapter(getApplication(), this);
    mListView.setAdapter(adapter);
    mListView.setCacheColorHint(0);
    mListView.setOnItemClickListener(this);
    mListView.setOnCreateContextMenuListener(this);
    mListView.setSelector(R.drawable.list_selector_no_background);

    //mDefaultIconsColor = getResources().getColor(R.color.default_icons_color_filter);
    
    // Handle the message to display when there are no files
    enableEmptyView(mAvailableFilesCount == 0 && mCurrentFilesCount == 0);
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:65,代码来源:SubtitlesWizardActivity.java

示例6: onCreate

import android.widget.ListView; //导入方法依赖的package包/类
@Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);

        getWindow().setFlags(LayoutParams.FLAG_NOT_TOUCH_MODAL, LayoutParams.FLAG_NOT_TOUCH_MODAL);
        getWindow().setFlags(LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH, LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH);

        // Notify the application that the activity has started
        CustomApplication app = (CustomApplication)getApplication();
        app.setAutoScraperActive(true);
        mScraper = new Scraper(this);

        // Check if the intent which created this activity contains a folder path
        Uri folderUri = getIntent().getData();
        if (folderUri != null) {
            mFolderMode = true;
            // FIXME: this is broken for smb:// files
            mFolderPath = folderUri.getPath();
            if (DBG) Log.d(TAG, "onCreate : search in folder " + mFolderPath);
        }
        else {
            mFolderMode = false;
            mFolderPath = null;
            if (DBG) Log.d(TAG, "onCreate : search in the full database");
        }

        setContentView(R.layout.auto_scraper_main);

        mMainView = findViewById(R.id.main_view);
        mAbortButton = (Button)findViewById(R.id.abort_button);
        mAbortButton.setOnClickListener(this);
        mExitButton = (Button)findViewById(R.id.exit_button);
        mExitButton.setOnClickListener(this);

        mListView = (ListView) findViewById(R.id.list_items);
        mListView.setTextFilterEnabled(true);
        mListView.setCacheColorHint(0);
        mListView.setSelector(R.drawable.list_selector_no_background);
        mListView.setOnCreateContextMenuListener(this);
        mListView.setOnScrollListener(this);
        mListView.setOnKeyListener(this);

        mActivityFileCursor = getFileListCursor();
        getColumnIndices(mActivityFileCursor);
        buildFileProperties(mActivityFileCursor);
        mAdapterFileCursor = buildAdapterCursor(mActivityFileCursor);

        mAdapter = new AutoScraperAdapter(getApplication(), this,
                                          R.layout.auto_scraper_item,
                                          mAdapterFileCursor);
        mListView.setAdapter(mAdapter);
/*
        if (!mListView.isInTouchMode()) {
            // The application is remotely controlled => set the focus by default
            // on the Cancel button so that the user can abort the task with a 
            // single click instead of navigating the full ListView
            mAbortButton.requestFocus();
        }
*/
        mEmptyView = buildEmptyView();
        mListView.setEmptyView(mEmptyView);
        updateControlButtons(false);
        if (mFileCount > 0) {
            mMainView.setVisibility(View.VISIBLE);
        }
        else {
            mMainView.setVisibility(View.GONE);
        }

        mIsLargeScreen = getResources().getConfiguration().isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE)|| TVUtils.isTV(this);

        PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
        mWakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE, "AutoScraperActivity");
    }
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:75,代码来源:AutoScraperActivity.java


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