当前位置: 首页>>代码示例>>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;未经允许,请勿转载。