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


Java ListView.setCacheColorHint方法代码示例

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


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

示例1: onCreate

import android.widget.ListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ListView lv = new ListView(mContext);
    lv.setCacheColorHint(Color.TRANSPARENT);
    lv.setFadingEdgeLength(0);
    lv.setAdapter(new SimpleHomeAdapter(mContext, mItems));

    lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Intent intent = new Intent(mContext, mClasses[position]);
            startActivity(intent);
        }
    });

    setContentView(lv);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:SimpleHomeActivity.java

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

示例3: onActivityCreated

import android.widget.ListView; //导入方法依赖的package包/类
@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.
        curCheckFilterId = 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 AccountFiltersListAdapter(getActivity(), null);
        //getListView().setEmptyView(getActivity().findViewById(R.id.progress_container));
        //getActivity().findViewById(android.R.id.empty).setVisibility(View.GONE);
        setListAdapter(mAdapter);
        registerForContextMenu(lv);

        
        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);
    }
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:52,代码来源:AccountFiltersListFragment.java

示例4: setItems

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

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

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

示例7: onCreateView

import android.widget.ListView; //导入方法依赖的package包/类
@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {


    kanalkoder = new ArrayList<String>(App.grunddata.p4koder);

    for (String k : kanalkoder) {
      if (App.grunddata.kanalFraKode.get(k) == null) {
        new IllegalStateException("Kanalkode mangler! Det her må ikke ske!").printStackTrace();
        App.grunddata.kanalFraKode.put(k, new Kanal(null)); // reparér problemet :-(
      }
    }


    // Da der er tale om et fast lille antal kanaler er der ikke grund til det store bogholderi
    // Så vi husker bare viewsne i er array
    listeElementer = new View[kanalkoder.size()];
    kanaladapter = new KanalAdapter();

    // Opbyg arrayet på forhånd for jævnere visning
    for (int pos = 0; pos < listeElementer.length; pos++) kanaladapter.bygListeelement(pos);

    // Sæt baggrunden. Normalt ville man gøre det fra XML eller med
    //getListView().setBackgroundResource(R.drawable.main_app_bg);

    ListView lv = new ListView(getActivity());
    lv.setAdapter(kanaladapter);
    lv.setOnItemClickListener(this);

//    lv.setBackgroundColor( 0xffa0a0a0);
//    lv.setDivider(new ColorDrawable(0x80ffffff));
//    lv.setDividerHeight(2);

    // Sørg for at baggrunden bliver tegnet, også når listen scroller.
    // Se http://android-developers.blogspot.com/2009/01/why-is-my-list-black-android.html
    lv.setCacheColorHint(0x00000000);
    // Man kunne have en ensfarvet baggrund, det gør scroll mere flydende
    //getListView().setCacheColorHint(0xffe4e4e4);
    return lv;
  }
 
开发者ID:nordfalk,项目名称:EsperantoRadio,代码行数:41,代码来源:P4kanalvalg_frag.java

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

示例9: onActivityCreated

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

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

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