當前位置: 首頁>>代碼示例>>Java>>正文


Java TabHost.setOnTabChangedListener方法代碼示例

本文整理匯總了Java中android.widget.TabHost.setOnTabChangedListener方法的典型用法代碼示例。如果您正苦於以下問題:Java TabHost.setOnTabChangedListener方法的具體用法?Java TabHost.setOnTabChangedListener怎麽用?Java TabHost.setOnTabChangedListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.TabHost的用法示例。


在下文中一共展示了TabHost.setOnTabChangedListener方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import android.widget.TabHost; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setResult(RESULT_CANCELED);
  setContentView(R.layout.folder_picker);

  TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost);
  tabHost.setup();
  
  tabHost.addTab(tabHost.newTabSpec("t1").setIndicator(getString(R.string.folder_new)).setContent(this));
  tabHost.addTab(tabHost.newTabSpec("t2").setIndicator(getString(R.string.folder_existing)).setContent(this));
  tabHost.setCurrentTab(0);
  tabHost.setOnTabChangedListener(this);

  onTabChanged(null);

  mIconPicker = new IconPicker(this, true);
  mIconSelect = (ImageView) findViewById(R.id.folder_icon);
  mIconSelect.setOnClickListener(this);
}
 
開發者ID:sunnygoyal,項目名稱:PowerToggles,代碼行數:21,代碼來源:FolderPick.java

示例2: onCreateView

import android.widget.TabHost; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.activity_my_files, container, false);

    myFileList = (ListView) v.findViewById(R.id.myFileList);
    myFileList.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    myFileList.setOnItemClickListener(this);

    allEntities = FileSelectHelper.getFileEntities(FileSelectorActivity.getServerResponse());

    // Init tab host categories {My files}
    tabHostMyFile = (TabHost) v.findViewById(R.id.tabHostMyFiles);
    tabHostMyFile.setup();

    initTabHost(tabHostMyFile, getMyFilesCategories(allEntities));
    tabHostMyFile.setOnTabChangedListener(new MyFilesCategoriesListener());

    myFileList.setAdapter(getArrayAdapterForMyFiles(allEntities, tabHostMyFile.getCurrentTabTag()));

    FileEntity currentEntity = FileSelectorActivity.getCurrentEntity();
    tabHostMyFile.setCurrentTab(currentTab);
    FileSelectorActivity.setCurrentEntity(currentEntity);

    return v;
}
 
開發者ID:SequencingDOTcom,項目名稱:RTP-API-Gradle-Maven-Android-File-Selector-Java,代碼行數:27,代碼來源:MyFileActivity.java

示例3: onCreateView

import android.widget.TabHost; //導入方法依賴的package包/類
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState)
{
    super.onCreateView(inflater, container, savedInstanceState);
    
    View v = inflater.inflate(R.layout.result_tabhost_pager, container, false);
	tabHost = (TabHost) v.findViewById(android.R.id.tabhost);
	tabHost.setup();
	tabHost.setOnTabChangedListener(this);
	
	for (int i = 0; i < pagerAdapter.getCount(); i++) {
		TabSpec tab = tabHost.newTabSpec(String.valueOf(i));
		//tab.setIndicator(getActivity().getResources().getStringArray(R.array.result_page_title)[i]);
		tab.setContent(android.R.id.tabcontent);
		    		    		
		View indicator = inflater.inflate(R.layout.tabhost_indicator, null);
		TextView title = (TextView) indicator.findViewById(android.R.id.title);
		title.setText(pagerAdapter.getPageTitle(i));
		tab.setIndicator(indicator);
		tabHost.addTab(tab);
	}

    viewPager = (ExtendedViewPager) v.findViewById(R.id.pager);
    viewPager.setAdapter(pagerAdapter);
    
    viewPager.setOnPageChangeListener(this);
    setCurrentPosition(0);

	scroller = (HorizontalScrollView) v.findViewById(R.id.tabwidget_scrollview);
   	viewPager.setCurrentItem(initPageIndex);
	
    return v;
}
 
開發者ID:rtr-nettest,項目名稱:open-rmbt,代碼行數:34,代碼來源:QoSTestDetailPagerFragment.java

示例4: createView

import android.widget.TabHost; //導入方法依賴的package包/類
private View createView(View v, LayoutInflater inflater, int currentPage) {
	tabHost = (TabHost) v.findViewById(android.R.id.tabhost);
	tabHost.setup();
	tabHost.setOnTabChangedListener(this);
	
	for (int i = 0; i < pagerAdapter.getCount(); i++) {
		TabSpec tab = tabHost.newTabSpec(String.valueOf(i));
		//tab.setIndicator(getActivity().getResources().getStringArray(R.array.result_page_title)[i]);
		tab.setContent(android.R.id.tabcontent);
		    		
		
		View indicator = inflater.inflate(R.layout.tabhost_indicator, null);
		TextView title = (TextView) indicator.findViewById(android.R.id.title);
		title.setText(getActivity().getResources().getStringArray(R.array.result_page_title)[RMBTResultPagerAdapter.RESULT_PAGE_TAB_TITLE_MAP.get(i)]);
		
		if (MAP_INDICATOR_DYNAMIC_VISIBILITY) {
			if (i == RMBTResultPagerAdapter.RESULT_PAGE_MAP) {
				indicator.setVisibility(View.GONE);
			}
		}
		tab.setIndicator(indicator);
		
		tabHost.addTab(tab);
	}
	
	scroller = (HorizontalScrollView) v.findViewById(R.id.tabwidget_scrollview);
	
    viewPager = (ExtendedViewPager) v.findViewById(R.id.pager);
    viewPager.setAdapter(pagerAdapter);
    
    viewPager.setOnPageChangeListener(this);
    setCurrentPosition(currentPage);

    return v;
}
 
開發者ID:rtr-nettest,項目名稱:open-rmbt,代碼行數:36,代碼來源:RMBTResultPagerFragment.java

示例5: setupTabs

import android.widget.TabHost; //導入方法依賴的package包/類
protected void setupTabs()
{
	TabHost tabHost = (TabHost) findViewById(R.id.tabhost);
	tabHost.setup();

	//  get the tab tags.
	mTagHidden = getResources().getString(R.string.hidden_tab);
	mTagFile = getResources().getString(R.string.file_tab);
	mTagAnnotate = getResources().getString(R.string.annotate_tab);
	mTagPages = getResources().getString(R.string.pages_tab);

	//  first tab is and stays hidden.
	//  when the search tab is selected, we programmatically "select" this hidden tab
	//  which results in NO tabs appearing selected in this tab host.
	setupTab(tabHost, mTagHidden, R.id.hiddenTab, R.layout.tab);
	tabHost.getTabWidget().getChildTabViewAt(0).setVisibility(View.GONE);

	//  these tabs are shown.
	setupTab(tabHost, mTagFile, R.id.fileTab, R.layout.tab_left);
	setupTab(tabHost, mTagAnnotate, R.id.annotateTab, R.layout.tab);
	setupTab(tabHost, mTagPages, R.id.pagesTab, R.layout.tab_right);

	//  start by showing the edit tab
	tabHost.setCurrentTabByTag(mTagFile);

	tabHost.setOnTabChangedListener(this);
}
 
開發者ID:ArtifexSoftware,項目名稱:mupdf-android-viewer-nui,代碼行數:28,代碼來源:DocActivityView.java

示例6: onActivityCreated

import android.widget.TabHost; //導入方法依賴的package包/類
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    mTextViewTitleExample.setText(R.string.criteria_stateelement_ex1_title);
    mTextViewDescriptionExample.setText(R.string.criteria_stateelement_ex1_description);
    mTextViewTitleExempleAxsYes.setText(R.string.criteria_accessible_example);
    mTextViewOptionEnabled.setText(getString(R.string.criteria_template_option_tb));

    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout myView = (LinearLayout) inflater.inflate(R.layout.exstateelmts1_frag, null);
    mFrameLayoutExampleAxsYes.addView(myView);

    mTextViewTitleExempleAxsNo.setText(R.string.criteria_not_accessible_example);

    LinearLayout myView2 = (LinearLayout) inflater.inflate(R.layout.exstateelmts1_frag, null);

    mFrameLayoutExampleAxsNo.addView(myView2);

    //HostYesAxs
    String[] tabslabs = new String[2];
    tabslabs[0] = getString(R.string.criteria_stateelement_ex1_public);
    tabslabs[1] = getString(R.string.criteria_stateelement_ex1_private);
    TabHost hostYes = initTabHost(myView);
    hostYes.setOnTabChangedListener(new TabHostListener(hostYes, tabslabs));
   setContentDescription(hostYes, tabslabs);

    for (int i = 0; i < hostYes.getTabWidget().getChildCount(); i++)
        hostYes.getTabWidget().getChildAt(i).setBackgroundResource(R.drawable.tab_selector);

    //HostNoAxs
    TabHost hostNo = initTabHost(myView2);
    for (int i = 0; i < hostNo.getTabWidget().getChildCount(); i++)
        hostNo.getTabWidget().getChildAt(i).setBackgroundResource(R.drawable.tab_selector);

}
 
開發者ID:Orange-OpenSource,項目名稱:m-dan,代碼行數:37,代碼來源:ExStateElmts1Fragment.java

示例7: onCreate

import android.widget.TabHost; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.cfg_strectch_editor);
  mImg = (Bitmap) getIntent().getParcelableExtra("img");

  mStretchRect = getExtra(KEY_STRETCH);
  mPaddingRect = getExtra(KEY_PADDING);

  mTabHost = (TabHost) findViewById(android.R.id.tabhost);
  mTabHost.setup();
  mPager = (SwipePager) findViewById(R.id.swipeTabs);

  mTabHost.addTab(mTabHost.newTabSpec("t1").setIndicator(getString(R.string.npe_stretch)).setContent(this));
  mTabHost.addTab(mTabHost.newTabSpec("t2").setIndicator(getString(R.string.npe_padding)).setContent(this));
  mTabHost.setOnTabChangedListener(this);
  mPager.setOnPageChangeListener(this);
  mPager.setDisplayChild(0);

  
  mNinePatchView = (NinePatchView) findViewById(R.id.prewiewHolder);
  mNinePatchView.setBitmap(mImg);
  mNinePatchView.setDim(mStretchRect);
  LayoutParams lp = mNinePatchView.getLayoutParams();
  lp.height = Math.max(lp.height, mImg.getHeight() * 3 / 2);

  mStretchView = setRect(R.id.stretch_rect, mStretchRect, 2);
  setRect(R.id.padding_rect, mPaddingRect, 3);
}
 
開發者ID:sunnygoyal,項目名稱:PowerToggles,代碼行數:30,代碼來源:NinePatchEditor.java

示例8: onCreate

import android.widget.TabHost; //導入方法依賴的package包/類
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        backGround = (LinearLayout) findViewById(R.id.background);
        getSupportActionBar().hide();

        tabHost = (TabHost)findViewById(R.id.tab_host);
        tabHost.setup();
        tabHost.setOnTabChangedListener(new TabHost.OnTabChangeListener() {
            @Override
            public void onTabChanged(String tabId) {
                FragmentTransaction fragmentTransaction = getFragmentManager()
                        .beginTransaction();
                if(TextUtils.equals("first",tabId)){
                    //
                    contents = new homeFragement();
                }else if(TextUtils.equals("second",tabId)){
                    //
                    contents = new downloadFragment();
                }
                fragmentTransaction.replace(android.R.id.tabcontent, contents,"frag");
                fragmentTransaction.commit();
            }
        });
        tabHost.addTab(tabHost.newTabSpec("first").setIndicator("主頁").setContent(new TabFactory(this)));
        tabHost.addTab(tabHost.newTabSpec("second").setIndicator("下載").setContent(new TabFactory(this)));

//        背景圖片透明度
        backGround.getBackground().setAlpha(100);

    }
 
開發者ID:webhood,項目名稱:ThisBili,代碼行數:33,代碼來源:MainActivity.java

示例9: onCreateView

import android.widget.TabHost; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    rootView= inflater.inflate(R.layout.fragment_first_aid, container, false);



    viewPager = (ViewPager) rootView.findViewById(R.id.view_pager);
    List<Fragment> listFragments = new ArrayList<Fragment>();
    listFragments.add(new BurnsFragment());
    listFragments.add(new CprFragment());
    listFragments.add(new Fragment3());

    viewPager.setOffscreenPageLimit(listFragments.size());

    MyFragmentPagerAdapter myFragmentPagerAdapter = new MyFragmentPagerAdapter(getFragmentManager(),listFragments);
    viewPager.setAdapter(myFragmentPagerAdapter);
    viewPager.setOnPageChangeListener(this);
    tabHost = (TabHost) rootView.findViewById(R.id.tabHost);
    tabHost.setup();

    String[] tabNames = {"Burns", "CPR", "Fire"};
    for(int i=0; i<tabNames.length; i++){
        TabHost.TabSpec tabSpec;
        tabSpec = tabHost.newTabSpec(tabNames[i]);
        tabSpec.setIndicator(tabNames[i]);
        tabSpec.setContent(new FakeContent(getActivity().getApplicationContext()));
        tabHost.addTab(tabSpec);
    }
    tabHost.setOnTabChangedListener(this);

    return rootView;
}
 
開發者ID:DamianPilot382,項目名稱:Health-App,代碼行數:34,代碼來源:FirstAidFragment.java

示例10: onCreateView

import android.widget.TabHost; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.activity_sample_files, container, false);

    sampleFileList = (ListView) v.findViewById(R.id.sampleFileList);
    sampleFileList.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    sampleFileList.setOnItemClickListener(this);

    allEntities = FileSelectHelper.getFileEntities(FileSelectorActivity.getServerResponse());

    // Init tab host categories { Sample files}
    tabHostSampleFile = (TabHost) v.findViewById(R.id.tabHostSampleFiles);
    tabHostSampleFile.setup();

    initTabHost(tabHostSampleFile, getSampleFilesSubCategories());
    tabHostSampleFile.setOnTabChangedListener(new SampleFilesCategoriesListener());

    ArrayAdapter<SpannableString> listAdapter = null;
    if(tabHostSampleFile.getCurrentTabTag().equals(FileSelectHelper.ATTR_SAMPLE_ALL)) {
        listAdapter = getArrayAdapterForSampleFiles(allEntities, null);
    } else {
        listAdapter = getArrayAdapterForSampleFiles(allEntities, tabHostSampleFile.getCurrentTabTag());
    }
    sampleFileList.setAdapter(listAdapter);

    FileEntity currentEntity = FileSelectorActivity.getCurrentEntity();
    tabHostSampleFile.setCurrentTab(currentTab);
    FileSelectorActivity.setCurrentEntity(currentEntity);

    return v;
}
 
開發者ID:SequencingDOTcom,項目名稱:RTP-API-Gradle-Maven-Android-File-Selector-Java,代碼行數:33,代碼來源:SampleFileActivity.java

示例11: FileGalleryPreviewDialog

import android.widget.TabHost; //導入方法依賴的package包/類
public FileGalleryPreviewDialog(Context context) {
	super(context);
	
	View dialogView = getLayoutInflater().inflate(R.layout.label_dialog, null);
	setView(dialogView);
	
	setButton(DialogInterface.BUTTON_POSITIVE, getContext().getResources().getString(R.string.confirm_dialog_button),
			new OnClickListener() {
				
				@Override
				public void onClick(DialogInterface dialog, int which) {
					// do nothing
				}
			});
	
	tabHost = (TabHost) dialogView.findViewById(R.id.label_tabhost);
	tabHost.setup();
	
	tabHost.setOnTabChangedListener(new OnTabChangeListener() {
		
		@Override
		public void onTabChanged(String tabId) {
			// Hide/show video preview so it's not visible in background on tab change
			if ("video_preview".equals(tabId)) {
				videoView.setVisibility(View.VISIBLE);
				videoView.start();
			} else {
				if (videoView != null) {
					videoView.setVisibility(View.GONE);
				}
			}
		}
	});
}
 
開發者ID:FAIMS,項目名稱:faims-android,代碼行數:35,代碼來源:FileGalleryPreviewDialog.java

示例12: LabelDialog

import android.widget.TabHost; //導入方法依賴的package包/類
@SuppressLint("InflateParams")
public LabelDialog(Context context) {
	super(context);
	
	tabs = new ArrayList<String>();
	tabSpecs = new ArrayList<TabHost.TabSpec>();
	
	setButton(DialogInterface.BUTTON_NEGATIVE, getContext().getResources().getString(R.string.cancel_dialog_button),
			new OnClickListener() {
		
		@Override
		public void onClick(DialogInterface dialog, int which) {
			// User cancelled the dialog
		}
	});

	View labelDialogView = getLayoutInflater().inflate(R.layout.label_dialog, null);
	setView(labelDialogView);
	
	tabHost = (TabHost) labelDialogView.findViewById(R.id.label_tabhost);
	tabHost.setup();
	// Hide soft keyboard on tab change
	tabHost.setOnTabChangedListener(new OnTabChangeListener() {
		
		@Override
		public void onTabChanged(String tabId) {
			handleTabChange(tabId);
		}
	});
}
 
開發者ID:FAIMS,項目名稱:faims-android,代碼行數:31,代碼來源:LabelDialog.java

示例13: onCreateView

import android.widget.TabHost; //導入方法依賴的package包/類
@Override
 public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState)
 {
     if (savedInstanceState != null && savedInstanceState.containsKey(BUNDLE_QOS_RESULTS)) {
     	try {
	setQoSResult(new QoSServerResultCollection(new JSONArray(savedInstanceState.getString(BUNDLE_QOS_RESULTS))));
	setDetailType(DetailType.valueOf(savedInstanceState.getString(BUNDLE_DETAIL_TYPE)));
} catch (JSONException e) {
	//e.printStackTrace();
}
     }
     //DetailType detailType = DetailType.valueOf(args.getString(ARG_DETAIL_TYPE));
     pagerAdapter = new QoSCategoryPagerAdapter((RMBTMainActivity) getActivity(), handler, results);
     
     View v = inflater.inflate(R.layout.result_tabhost_pager, container, false);
 	tabHost = (TabHost) v.findViewById(android.R.id.tabhost);
 	tabHost.setup();
 	tabHost.setOnTabChangedListener(this);
 	
 	for (int i = 0; i < pagerAdapter.getCount(); i++) {
 		TabSpec tab = tabHost.newTabSpec(String.valueOf(i));
 		//tab.setIndicator(getActivity().getResources().getStringArray(R.array.result_page_title)[i]);
 		tab.setContent(android.R.id.tabcontent);
 		    		    		
 		View indicator = inflater.inflate(R.layout.tabhost_indicator, null);
 		TextView title = (TextView) indicator.findViewById(android.R.id.title);
 		title.setText(pagerAdapter.getPageTitle(i));
 		tab.setIndicator(indicator);
 		tabHost.addTab(tab);
 	}

     viewPager = (ExtendedViewPager) v.findViewById(R.id.pager);
     viewPager.setAdapter(pagerAdapter);
     
     viewPager.setOnPageChangeListener(this);
     setCurrentPosition(0);

 	scroller = (HorizontalScrollView) v.findViewById(R.id.tabwidget_scrollview);
 	

     if (initPosition != null) {
     	viewPager.setCurrentItem(initPosition);
     }
 	
     return v;
 }
 
開發者ID:rtr-nettest,項目名稱:open-rmbt,代碼行數:47,代碼來源:QoSCategoryPagerFragment.java

示例14: onCreate

import android.widget.TabHost; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    activity=this;
    
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    initialLoad();

    final TabHost tabHost = getTabHost();

    setupAccountsTab(tabHost);
    setupBlotterTab(tabHost);
    setupBudgetsTab(tabHost);
    setupReportsTab(tabHost);

    MyPreferences.StartupScreen screen = MyPreferences.getStartupScreen(this);
    tabHost.setCurrentTabByTag(screen.tag);

    tabHost.setOnTabChangedListener(this);

}
 
開發者ID:tiberiusteng,項目名稱:financisto1-holo,代碼行數:24,代碼來源:MainActivity.java

示例15: onFinishInflate

import android.widget.TabHost; //導入方法依賴的package包/類
@Override
protected void onFinishInflate() {
    mTabHost = (TabHost)findViewById(R.id.emoji_category_tabhost);
    mTabHost.setup();
    for (final EmojiCategory.CategoryProperties properties
            : mEmojiCategory.getShownCategories()) {
        addTab(mTabHost, properties.mCategoryId);
    }
    mTabHost.setOnTabChangedListener(this);
    final TabWidget tabWidget = mTabHost.getTabWidget();
    tabWidget.setStripEnabled(mCategoryIndicatorEnabled);
    if (mCategoryIndicatorEnabled) {
        // On TabWidget's strip, what looks like an indicator is actually a background.
        // And what looks like a background are actually left and right drawables.
        tabWidget.setBackgroundResource(mCategoryIndicatorDrawableResId);
        tabWidget.setLeftStripDrawable(mCategoryIndicatorBackgroundResId);
        tabWidget.setRightStripDrawable(mCategoryIndicatorBackgroundResId);
    }

    mEmojiPalettesAdapter = new EmojiPalettesAdapter(mEmojiCategory, this);

    mEmojiPager = (ViewPager)findViewById(R.id.emoji_keyboard_pager);
    mEmojiPager.setAdapter(mEmojiPalettesAdapter);
    mEmojiPager.setOnPageChangeListener(this);
    mEmojiPager.setOffscreenPageLimit(0);
    mEmojiPager.setPersistentDrawingCache(PERSISTENT_NO_CACHE);
    mEmojiLayoutParams.setPagerProperties(mEmojiPager);

    mEmojiCategoryPageIndicatorView =
            (EmojiCategoryPageIndicatorView)findViewById(R.id.emoji_category_page_id_view);
    mEmojiCategoryPageIndicatorView.setColors(
            mCategoryPageIndicatorColor, mCategoryPageIndicatorBackground);
    mEmojiLayoutParams.setCategoryPageIdViewProperties(mEmojiCategoryPageIndicatorView);

    setCurrentCategoryId(mEmojiCategory.getCurrentCategoryId(), true /* force */);

    final LinearLayout actionBar = (LinearLayout)findViewById(R.id.emoji_action_bar);
    mEmojiLayoutParams.setActionBarProperties(actionBar);

    // deleteKey depends only on OnTouchListener.
    mDeleteKey = (ImageButton)findViewById(R.id.emoji_keyboard_delete);
    mDeleteKey.setBackgroundResource(mFunctionalKeyBackgroundId);
    mDeleteKey.setTag(Constants.CODE_DELETE);
    mDeleteKey.setOnTouchListener(mDeleteKeyOnTouchListener);

    // {@link #mAlphabetKeyLeft}, {@link #mAlphabetKeyRight, and spaceKey depend on
    // {@link View.OnClickListener} as well as {@link View.OnTouchListener}.
    // {@link View.OnTouchListener} is used as the trigger of key-press, while
    // {@link View.OnClickListener} is used as the trigger of key-release which does not occur
    // if the event is canceled by moving off the finger from the view.
    // The text on alphabet keys are set at
    // {@link #startEmojiPalettes(String,int,float,Typeface)}.
    mAlphabetKeyLeft = (TextView)findViewById(R.id.emoji_keyboard_alphabet_left);
    mAlphabetKeyLeft.setBackgroundResource(mFunctionalKeyBackgroundId);
    mAlphabetKeyLeft.setTag(Constants.CODE_ALPHA_FROM_EMOJI);
    mAlphabetKeyLeft.setOnTouchListener(this);
    mAlphabetKeyLeft.setOnClickListener(this);
    mAlphabetKeyRight = (TextView)findViewById(R.id.emoji_keyboard_alphabet_right);
    mAlphabetKeyRight.setBackgroundResource(mFunctionalKeyBackgroundId);
    mAlphabetKeyRight.setTag(Constants.CODE_ALPHA_FROM_EMOJI);
    mAlphabetKeyRight.setOnTouchListener(this);
    mAlphabetKeyRight.setOnClickListener(this);
    mSpacebar = findViewById(R.id.emoji_keyboard_space);
    mSpacebar.setBackgroundResource(mSpacebarBackgroundId);
    mSpacebar.setTag(Constants.CODE_SPACE);
    mSpacebar.setOnTouchListener(this);
    mSpacebar.setOnClickListener(this);
    mEmojiLayoutParams.setKeyProperties(mSpacebar);
    mSpacebarIcon = findViewById(R.id.emoji_keyboard_space_icon);
}
 
開發者ID:sergeychilingaryan,項目名稱:AOSP-Kayboard-7.1.2,代碼行數:71,代碼來源:EmojiPalettesView.java


注:本文中的android.widget.TabHost.setOnTabChangedListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。