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


Java TextView.setContentDescription方法代碼示例

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


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

示例1: setTabLayoutContentDescriptions

import android.widget.TextView; //導入方法依賴的package包/類
private void setTabLayoutContentDescriptions() {
    LayoutInflater inflater = getLayoutInflater();
    int gap = mDayZeroAdapter == null ? 0 : 1;
    for (int i = 0, count = mTabLayout.getTabCount(); i < count; i++) {
        TabLayout.Tab tab = mTabLayout.getTabAt(i);
        TextView view = (TextView) inflater.inflate(R.layout.tab_my_schedule, mTabLayout, false);
        view.setId(baseTabViewId + i);
        view.setText(tab.getText());
        if (i == 0) {
            view.setContentDescription(
                    getString(R.string.talkback_selected,
                            getString(R.string.a11y_button, tab.getText())));
        } else {
            view.setContentDescription(
                    getString(R.string.a11y_button, tab.getText()));
        }
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            view.announceForAccessibility(
                    getString(R.string.my_schedule_tab_desc_a11y, getDayName(i - gap)));
        }
        tab.setCustomView(view);
    }
}
 
開發者ID:dreaminglion,項目名稱:iosched-reader,代碼行數:24,代碼來源:MyScheduleActivity.java

示例2: setView

import android.widget.TextView; //導入方法依賴的package包/類
private boolean setView(int id, String packageName) {
    TextView donate = (TextView) findViewById(id);
    PackageManager pm = getPackageManager();
    try {
        ApplicationInfo info = pm.getApplicationInfo(packageName, 0);
        if (!info.enabled) {
            return false;
        }
        CharSequence label = getLabel(pm, info);
        donate.setContentDescription(label);
        donate.setCompoundDrawablesWithIntrinsicBounds(null, cropDrawable(pm.getApplicationIcon(info)), null, null);
        donate.setText(label);
        donate.setClickable(true);
        donate.setOnClickListener(this);
        donate.setVisibility(View.VISIBLE);
        return true;
    } catch (PackageManager.NameNotFoundException e) {
        UILog.d("cannot find package " + packageName, e);
        return false;
    }
}
 
開發者ID:brevent,項目名稱:prevent,代碼行數:22,代碼來源:UserGuideActivity.java

示例3: layoutPunctuationsAndReturnStartIndexOfMoreSuggestions

import android.widget.TextView; //導入方法依賴的package包/類
private int layoutPunctuationsAndReturnStartIndexOfMoreSuggestions(
        final PunctuationSuggestions punctuationSuggestions, final ViewGroup stripView) {
    final int countInStrip = Math.min(punctuationSuggestions.size(), PUNCTUATIONS_IN_STRIP);
    for (int positionInStrip = 0; positionInStrip < countInStrip; positionInStrip++) {
        if (positionInStrip != 0) {
            // Add divider if this isn't the left most suggestion in suggestions strip.
            addDivider(stripView, mDividerViews.get(positionInStrip));
        }

        final TextView wordView = mWordViews.get(positionInStrip);
        final String punctuation = punctuationSuggestions.getLabel(positionInStrip);
        // {@link TextView#getTag()} is used to get the index in suggestedWords at
        // {@link SuggestionStripView#onClick(View)}.
        wordView.setTag(positionInStrip);
        wordView.setText(punctuation);
        wordView.setContentDescription(punctuation);
        wordView.setTextScaleX(1.0f);
        wordView.setCompoundDrawables(null, null, null, null);
        wordView.setTextColor(mColorAutoCorrect);
        stripView.addView(wordView);
        setLayoutWeight(wordView, 1.0f, mSuggestionsStripHeight);
    }
    mMoreSuggestionsAvailable = (punctuationSuggestions.size() > countInStrip);
    return countInStrip;
}
 
開發者ID:sergeychilingaryan,項目名稱:AOSP-Kayboard-7.1.2,代碼行數:26,代碼來源:SuggestionStripLayoutHelper.java

示例4: updateTextAndIcon

import android.widget.TextView; //導入方法依賴的package包/類
private void updateTextAndIcon(@Nullable final TextView textView,
            @Nullable final ImageView iconView) {
  final Drawable icon = mTab != null ? mTab.getIcon() : null;
  final CharSequence text = mTab != null ? mTab.getText() : null;
  final CharSequence contentDesc = mTab != null ? mTab.getContentDescription() : null;

  if (iconView != null) {
    if (icon != null) {
      iconView.setImageDrawable(icon);
      iconView.setVisibility(VISIBLE);
      setVisibility(VISIBLE);
    } else {
      iconView.setVisibility(GONE);
      iconView.setImageDrawable(null);
    }
    iconView.setContentDescription(contentDesc);
  }

  final boolean hasText = !TextUtils.isEmpty(text);
  if (textView != null) {
    if (hasText) {
      textView.setText(text);
      textView.setVisibility(VISIBLE);
      setVisibility(VISIBLE);
    } else {
      textView.setVisibility(GONE);
      textView.setText(null);
    }
    textView.setContentDescription(contentDesc);
  }

  if (iconView != null) {
    MarginLayoutParams lp = ((MarginLayoutParams) iconView.getLayoutParams());
    int bottomMargin = 0;
    if (hasText && iconView.getVisibility() == VISIBLE) {
      // If we're showing both text and icon, add some margin bottom to the icon
      bottomMargin = dpToPx(DEFAULT_GAP_TEXT_ICON);
    }
    if (bottomMargin != lp.bottomMargin) {
      lp.bottomMargin = bottomMargin;
      iconView.requestLayout();
    }
  }
        TooltipCompat.setTooltipText(this, hasText ? null : contentDesc);
}
 
開發者ID:commonsguy,項目名稱:cwac-crossport,代碼行數:46,代碼來源:TabLayoutLite.java

示例5: updateTextAndIcon

import android.widget.TextView; //導入方法依賴的package包/類
private void updateTextAndIcon(@Nullable TextView textView, @Nullable ImageView iconView) {
    Drawable icon;
    CharSequence text;
    CharSequence contentDesc;
    boolean hasText;
    if (this.mTab != null) {
        icon = this.mTab.getIcon();
    } else {
        icon = null;
    }
    if (this.mTab != null) {
        text = this.mTab.getText();
    } else {
        text = null;
    }
    if (this.mTab != null) {
        contentDesc = this.mTab.getContentDescription();
    } else {
        contentDesc = null;
    }
    if (iconView != null) {
        if (icon != null) {
            iconView.setImageDrawable(icon);
            iconView.setVisibility(0);
            setVisibility(0);
        } else {
            iconView.setVisibility(8);
            iconView.setImageDrawable(null);
        }
        iconView.setContentDescription(contentDesc);
    }
    if (TextUtils.isEmpty(text)) {
        hasText = false;
    } else {
        hasText = true;
    }
    if (textView != null) {
        if (hasText) {
            textView.setText(text);
            textView.setVisibility(0);
            setVisibility(0);
        } else {
            textView.setVisibility(8);
            textView.setText(null);
        }
        textView.setContentDescription(contentDesc);
    }
    if (iconView != null) {
        MarginLayoutParams lp = (MarginLayoutParams) iconView.getLayoutParams();
        int bottomMargin = 0;
        if (hasText && iconView.getVisibility() == 0) {
            bottomMargin = TabLayout.this.dpToPx(8);
        }
        if (bottomMargin != lp.bottomMargin) {
            lp.bottomMargin = bottomMargin;
            iconView.requestLayout();
        }
    }
    if (hasText || TextUtils.isEmpty(contentDesc)) {
        setOnLongClickListener(null);
        setLongClickable(false);
        return;
    }
    setOnLongClickListener(this);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:66,代碼來源:TabLayout.java

示例6: resetLayout

import android.widget.TextView; //導入方法依賴的package包/類
void resetLayout() {
    mContent.removeAllViewsInLayout();

    if (!FeatureFlags.NO_ALL_APPS_ICON) {
        // Add the Apps button
        Context context = getContext();
        int allAppsButtonRank = mLauncher.getDeviceProfile().inv.getAllAppsButtonRank();

        LayoutInflater inflater = LayoutInflater.from(context);
        TextView allAppsButton = (TextView)
                inflater.inflate(R.layout.all_apps_button, mContent, false);
        Drawable d = context.getResources().getDrawable(R.drawable.all_apps_button_icon);

        mLauncher.resizeIconDrawable(d);
        int scaleDownPx = getResources().getDimensionPixelSize(R.dimen.all_apps_button_scale_down);
        Rect bounds = d.getBounds();
        d.setBounds(bounds.left, bounds.top + scaleDownPx / 2, bounds.right - scaleDownPx,
                bounds.bottom - scaleDownPx / 2);
        allAppsButton.setCompoundDrawables(null, d, null, null);

        allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label));
        allAppsButton.setOnKeyListener(new HotseatIconKeyEventListener());
        if (mLauncher != null) {
            mLauncher.setAllAppsButton(allAppsButton);
            allAppsButton.setOnTouchListener(mLauncher.getHapticFeedbackTouchListener());
            allAppsButton.setOnClickListener(mLauncher);
            allAppsButton.setOnLongClickListener(mLauncher);
            allAppsButton.setOnFocusChangeListener(mLauncher.mFocusHandler);
        }

        // Note: We do this to ensure that the hotseat is always laid out in the orientation of
        // the hotseat in order regardless of which orientation they were added
        int x = getCellXFromOrder(allAppsButtonRank);
        int y = getCellYFromOrder(allAppsButtonRank);
        CellLayout.LayoutParams lp = new CellLayout.LayoutParams(x, y, 1, 1);
        lp.canReorder = false;
        mContent.addViewToCellLayout(allAppsButton, -1, allAppsButton.getId(), lp, true);
    }
}
 
開發者ID:michelelacorte,項目名稱:FlickLauncher,代碼行數:40,代碼來源:Hotseat.java

示例7: onCreateView

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

  String url = App.grunddata.android_json.optString("kontakt_url", "http://dr.dk");

  WebView webview = (WebView) rod.findViewById(R.id.webview);

  // Jacob: Fix for 'syg' webview-cache - se http://code.google.com/p/android/issues/detail?id=10789
  WebViewDatabase webViewDB = WebViewDatabase.getInstance(getActivity());
  if (webViewDB != null) {
    // OK, webviewet kan bruge sin cache
    webview.getSettings().setJavaScriptEnabled(true);
    webview.loadUrl(url);
    // hjælper det her??? webview.getSettings().setDatabasePath(...);
  } else {
    // Øv, vi viser URLen i en ekstern browser.
    // Når brugeren derefter trykker 'tilbage' ser han et tomt webview.
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
  }

  TextView titel = (TextView) rod.findViewById(R.id.titel);
  titel.setTypeface(App.skrift_gibson_fed);

  TextView version = (TextView) rod.findViewById(R.id.version);
  version.setTypeface(App.skrift_gibson);
  version.setText(App.versionsnavn);
  version.setContentDescription("\u00A0");  // SLUK for højtlæsning ... det virker ikke

  rod.findViewById(R.id.kontakt).setOnClickListener(this);
  return rod;
}
 
開發者ID:nordfalk,項目名稱:EsperantoRadio,代碼行數:33,代碼來源:Kontakt_info_om_frag.java

示例8: layoutWord

import android.widget.TextView; //導入方法依賴的package包/類
/**
 * Format appropriately the suggested word in {@link #mWordViews} specified by
 * <code>positionInStrip</code>. When the suggested word doesn't exist, the corresponding
 * {@link TextView} will be disabled and never respond to user interaction. The suggested word
 * may be shrunk or ellipsized to fit in the specified width.
 *
 * The <code>positionInStrip</code> argument is the index in the suggestion strip. The indices
 * increase towards the right for LTR scripts and the left for RTL scripts, starting with 0.
 * The position of the most important suggestion is in {@link #mCenterPositionInStrip}. This
 * usually doesn't match the index in <code>suggedtedWords</code> -- see
 * {@link #getPositionInSuggestionStrip(int,SuggestedWords)}.
 *
 * @param positionInStrip the position in the suggestion strip.
 * @param width the maximum width for layout in pixels.
 * @return the {@link TextView} containing the suggested word appropriately formatted.
 */
private TextView layoutWord(final Context context, final int positionInStrip, final int width) {
    final TextView wordView = mWordViews.get(positionInStrip);
    final CharSequence word = wordView.getText();
    if (positionInStrip == mCenterPositionInStrip && mMoreSuggestionsAvailable) {
        // TODO: This "more suggestions hint" should have a nicely designed icon.
        wordView.setCompoundDrawablesWithIntrinsicBounds(
                null, null, null, mMoreSuggestionsHint);
        // HACK: Align with other TextViews that have no compound drawables.
        wordView.setCompoundDrawablePadding(-mMoreSuggestionsHint.getIntrinsicHeight());
    } else {
        wordView.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
    }
    // {@link StyleSpan} in a content description may cause an issue of TTS/TalkBack.
    // Use a simple {@link String} to avoid the issue.
    wordView.setContentDescription(
            TextUtils.isEmpty(word)
                ? context.getResources().getString(R.string.spoken_empty_suggestion)
                : word.toString());
    final CharSequence text = getEllipsizedTextWithSettingScaleX(
            word, width, wordView.getPaint());
    final float scaleX = wordView.getTextScaleX();
    wordView.setText(text); // TextView.setText() resets text scale x to 1.0.
    wordView.setTextScaleX(scaleX);
    // A <code>wordView</code> should be disabled when <code>word</code> is empty in order to
    // make it unclickable.
    // With accessibility touch exploration on, <code>wordView</code> should be enabled even
    // when it is empty to avoid announcing as "disabled".
    wordView.setEnabled(!TextUtils.isEmpty(word)
            || AccessibilityUtils.getInstance().isTouchExplorationEnabled());
    return wordView;
}
 
開發者ID:sergeychilingaryan,項目名稱:AOSP-Kayboard-7.1.2,代碼行數:48,代碼來源:SuggestionStripLayoutHelper.java

示例9: resetLayout

import android.widget.TextView; //導入方法依賴的package包/類
void resetLayout() {
    mContent.removeAllViewsInLayout();

    // 在hotseat中顯示進入所有應用列表的圖標
    if (!FeatureFlags.NO_ALL_APPS_ICON) {
        // Add the Apps button
        Context context = getContext();
        int allAppsButtonRank = mLauncher.getDeviceProfile().inv.getAllAppsButtonRank();

        LayoutInflater inflater = LayoutInflater.from(context);
        TextView allAppsButton = (TextView)
                inflater.inflate(R.layout.all_apps_button, mContent, false);
        Drawable d = context.getResources().getDrawable(R.drawable.all_apps_button_icon);

        mLauncher.resizeIconDrawable(d);
        int scaleDownPx = getResources().getDimensionPixelSize(R.dimen.all_apps_button_scale_down);
        Rect bounds = d.getBounds();
        d.setBounds(bounds.left, bounds.top + scaleDownPx / 2, bounds.right - scaleDownPx,
                bounds.bottom - scaleDownPx / 2);
        allAppsButton.setCompoundDrawables(null, d, null, null);

        allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label));
        allAppsButton.setOnKeyListener(new HotseatIconKeyEventListener());
        if (mLauncher != null) {
            mLauncher.setAllAppsButton(allAppsButton);
            allAppsButton.setOnTouchListener(mLauncher.getHapticFeedbackTouchListener());
            allAppsButton.setOnClickListener(mLauncher);
            allAppsButton.setOnLongClickListener(mLauncher);
            allAppsButton.setOnFocusChangeListener(mLauncher.mFocusHandler);
        }

        // Note: We do this to ensure that the hotseat is always laid out in the orientation of
        // the hotseat in order regardless of which orientation they were added
        int x = getCellXFromOrder(allAppsButtonRank);
        int y = getCellYFromOrder(allAppsButtonRank);
        CellLayout.LayoutParams lp = new CellLayout.LayoutParams(x, y, 1, 1);
        lp.canReorder = false;
        mContent.addViewToCellLayout(allAppsButton, -1, allAppsButton.getId(), lp, true);
    }
}
 
開發者ID:TeamBrainStorm,項目名稱:SimpleUILauncher,代碼行數:41,代碼來源:Hotseat.java

示例10: setConnectedDeviceText

import android.widget.TextView; //導入方法依賴的package包/類
/**
 * Updates UI of current connection status and device name.
 */
private void setConnectedDeviceText() {

    TextView connectedIndicatorText = (TextView) findViewById(R.id.connectedIndicatorText);
    connectedIndicatorText.setText(connectedIndicatorText.getText());
    connectedIndicatorText.setTypeface(MBApp.getApp().getRobotoTypeface());
    TextView deviceName = (TextView) findViewById(R.id.deviceName);
    deviceName.setContentDescription(deviceName.getText());
    deviceName.setTypeface(MBApp.getApp().getRobotoTypeface());
    deviceName.setOnClickListener(this);
    ImageView connectedIndicatorIcon = (ImageView) findViewById(R.id.connectedIndicatorIcon);

    //Override the connection Icon in case of active flashing
    if(mActivityState == FlashActivityState.FLASH_STATE_FIND_DEVICE
            || mActivityState == FlashActivityState.FLASH_STATE_VERIFY_DEVICE
            || mActivityState == FlashActivityState.FLASH_STATE_WAIT_DEVICE_REBOOT
            || mActivityState == FlashActivityState.FLASH_STATE_INIT_DEVICE
            || mActivityState == FlashActivityState.FLASH_STATE_PROGRESS
            ) {
        connectedIndicatorIcon.setImageResource(R.drawable.device_status_connected);
        connectedIndicatorText.setText(getString(R.string.connected_to));

        return;
    }
    ConnectedDevice device = BluetoothUtils.getPairedMicrobit(this);
    if(!device.mStatus) {
        connectedIndicatorIcon.setImageResource(R.drawable.device_status_disconnected);
        connectedIndicatorText.setText(getString(R.string.not_connected));
        if(device.mName != null) {
            deviceName.setText(device.mName);
        } else {
            deviceName.setText("");
        }
    } else {
        connectedIndicatorIcon.setImageResource(R.drawable.device_status_connected);
        connectedIndicatorText.setText(getString(R.string.connected_to));
        if(device.mName != null) {
            deviceName.setText(device.mName);
        } else {
            deviceName.setText("");
        }
    }
}
 
開發者ID:Samsung,項目名稱:microbit,代碼行數:46,代碼來源:ProjectActivity.java

示例11: displayScreen

import android.widget.TextView; //導入方法依賴的package包/類
/**
 * Displays needed screen according to a pairing state and
 * allows to navigate through the connection screens.
 *
 * @param gotoState New pairing state.
 */
private void displayScreen(PAIRING_STATE gotoState) {
    //Reset all screens first
    pairTipView.setVisibility(View.GONE);
    newDeviceView.setVisibility(View.GONE);
    pairSearchView.setVisibility(View.GONE);
    connectDeviceView.setVisibility(View.GONE);

    logi("********** Connect: state from " + pairingState + " to " + gotoState);
    pairingState = gotoState;

    boolean mDeviceListAvailable = ((gotoState == PAIRING_STATE.PAIRING_STATE_CONNECT_BUTTON) ||
            (gotoState == PAIRING_STATE.PAIRING_STATE_ERROR));

    if(mDeviceListAvailable) {
        updatePairedDeviceCard();
        connectDeviceView.setVisibility(View.VISIBLE);
    }

    switch(gotoState) {
        case PAIRING_STATE_CONNECT_BUTTON:
            break;

        case PAIRING_STATE_ERROR:
            Arrays.fill(DEVICE_CODE_ARRAY, 0);
            findViewById(R.id.enter_pattern_step_2_gridview).setEnabled(true);
            newDeviceName = "";
            newDeviceCode = "";
            break;

        case PAIRING_STATE_STEP_1:
            pairTipView.setVisibility(View.VISIBLE);
            findViewById(R.id.ok_tip_step_1_btn).setOnClickListener(this);
            break;

        case PAIRING_STATE_STEP_2:
            newDeviceView.setVisibility(View.VISIBLE);
            findViewById(R.id.cancel_enter_pattern_step_2_btn).setVisibility(View.VISIBLE);
            findViewById(R.id.enter_pattern_step_2_title).setVisibility(View.VISIBLE);
            findViewById(R.id.oh_pretty_emoji).setVisibility(View.VISIBLE);

            displayLedGrid();
            break;

        case PAIRING_STATE_SEARCHING:
            if(pairSearchView != null) {
                pairSearchView.setVisibility(View.VISIBLE);
                TextView tvTitle = (TextView) findViewById(R.id.search_microbit_step_3_title);
                TextView tvSearchingStep = (TextView) findViewById(R.id.searching_microbit_step);
                tvSearchingStep.setContentDescription(tvSearchingStep.getText());
                TextView tvSearchingInstructions = (TextView) findViewById(R.id.searching_microbit_step_instructions);
                if(tvTitle != null) {
                    tvTitle.setText(R.string.searchingTitle);
                    findViewById(R.id.searching_progress_spinner).setVisibility(View.VISIBLE);
                    ((GifImageView) findViewById(R.id.searching_microbit_found_giffview))
                            .setImageResource(R.drawable.pairing_pin_screen_two);
                    if(currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
                        tvSearchingStep.setText(R.string.searching_tip_step_text_one_line);
                    } else {
                        tvSearchingStep.setText(R.string.searching_tip_step_text);
                    }
                    tvSearchingInstructions.setText(R.string.searching_tip_text_instructions);
                }
                justPaired = true;
            } else {
                justPaired = false;
            }
            break;
    }
}
 
開發者ID:Samsung,項目名稱:microbit,代碼行數:76,代碼來源:PairingActivity.java

示例12: SuggestionStripView

import android.widget.TextView; //導入方法依賴的package包/類
public SuggestionStripView(final Context context, final AttributeSet attrs,
        final int defStyle) {
    super(context, attrs, defStyle);

    final LayoutInflater inflater = LayoutInflater.from(context);
    inflater.inflate(R.layout.suggestions_strip, this);

    mSuggestionsStrip = (ViewGroup)findViewById(R.id.suggestions_strip);
    mVoiceKey = (ImageButton)findViewById(R.id.suggestions_strip_voice_key);
    mImportantNoticeStrip = findViewById(R.id.important_notice_strip);
    mStripVisibilityGroup = new StripVisibilityGroup(this, mSuggestionsStrip,
            mImportantNoticeStrip);

    for (int pos = 0; pos < SuggestedWords.MAX_SUGGESTIONS; pos++) {
        final TextView word = new TextView(context, null, R.attr.suggestionWordStyle);
        word.setContentDescription(getResources().getString(R.string.spoken_empty_suggestion));
        word.setOnClickListener(this);
        word.setOnLongClickListener(this);
        mWordViews.add(word);
        final View divider = inflater.inflate(R.layout.suggestion_divider, null);
        mDividerViews.add(divider);
        final TextView info = new TextView(context, null, R.attr.suggestionWordStyle);
        info.setTextColor(Color.WHITE);
        info.setTextSize(TypedValue.COMPLEX_UNIT_DIP, DEBUG_INFO_TEXT_SIZE_IN_DIP);
        mDebugInfoViews.add(info);
    }

    mLayoutHelper = new SuggestionStripLayoutHelper(
            context, attrs, defStyle, mWordViews, mDividerViews, mDebugInfoViews);

    mMoreSuggestionsContainer = inflater.inflate(R.layout.more_suggestions, null);
    mMoreSuggestionsView = (MoreSuggestionsView)mMoreSuggestionsContainer
            .findViewById(R.id.more_suggestions_view);
    mMoreSuggestionsBuilder = new MoreSuggestions.Builder(context, mMoreSuggestionsView);

    final Resources res = context.getResources();
    mMoreSuggestionsModalTolerance = res.getDimensionPixelOffset(
            R.dimen.config_more_suggestions_modal_tolerance);
    mMoreSuggestionsSlidingDetector = new GestureDetector(
            context, mMoreSuggestionsSlidingListener);

    final TypedArray keyboardAttr = context.obtainStyledAttributes(attrs,
            R.styleable.Keyboard, defStyle, R.style.SuggestionStripView);
    final Drawable iconVoice = keyboardAttr.getDrawable(R.styleable.Keyboard_iconShortcutKey);
    keyboardAttr.recycle();
    mVoiceKey.setImageDrawable(iconVoice);
    mVoiceKey.setOnClickListener(this);
}
 
開發者ID:sergeychilingaryan,項目名稱:AOSP-Kayboard-7.1.2,代碼行數:49,代碼來源:SuggestionStripView.java


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