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


Java TextView.setOnFocusChangeListener方法代码示例

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


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

示例1: onFinishInflate

import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected void onFinishInflate() {
    super.onFinishInflate();

    final Context context = getContext();

    textView = (TextView) getChildAt(0);
    textView.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
    textView.setHintTextColor(lessSignificantColor);
    textView.setHorizontalFadingEdgeEnabled(true);
    textView.setSingleLine();
    setValidateAmount(textView instanceof EditText);
    textView.addTextChangedListener(textViewListener);
    textView.setOnFocusChangeListener(textViewListener);

    contextButton = new View(context) {
        @Override
        protected void onMeasure(final int wMeasureSpec, final int hMeasureSpec) {
            setMeasuredDimension(textView.getCompoundPaddingRight(), textView.getMeasuredHeight());
        }
    };
    final LayoutParams chooseViewParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    chooseViewParams.gravity = Gravity.RIGHT;
    contextButton.setLayoutParams(chooseViewParams);
    this.addView(contextButton);

    updateAppearance();
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:30,代码来源:CurrencyAmountView.java

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

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


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