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


Java ViewGroup.requestFocus方法代码示例

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


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

示例1: onLayout

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public void onLayout(View target, View attachView)
{
    try
    {
        ViewGroup viewGroup = (ViewGroup)attachView.getRootView();
        if (target.getParent() != null && target.getParent() != viewGroup)
        {
            target.setVisibility(View.GONE);
            if (mFirstFocus)
                viewGroup.requestFocus();
        }
    }
    catch (Exception ex)
    {
        ex.printStackTrace();
    }
}
 
开发者ID:Dreamxiaoxuan,项目名称:AndroidTvDemo,代码行数:19,代码来源:BorderEffect.java

示例2: onCreateView

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

    if (fullScreen)
        hideActivityActionBar(savedInstanceState == null);

    ViewGroup view = (ViewGroup) inflater.inflate(R.layout.full_screen_dialog, container, false);

    initToolbar(view);

    if (fullScreen)
        setThemeBackground(view);

    view.setFocusableInTouchMode(true);
    view.requestFocus();

    return view;
}
 
开发者ID:franmontiel,项目名称:FullScreenDialog,代码行数:21,代码来源:FullScreenDialogFragment.java

示例3: requestFocus

import android.view.ViewGroup; //导入方法依赖的package包/类
public boolean requestFocus() {
    ViewGroup viewGroup = this.mDecorToolbar.getViewGroup();
    if (viewGroup == null || viewGroup.hasFocus()) {
        return false;
    }
    viewGroup.requestFocus();
    return true;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:ToolbarActionBar.java

示例4: handleDecodeInternally

import android.view.ViewGroup; //导入方法依赖的package包/类
private void handleDecodeInternally(Result rawResult, ResultHandler resultHandler, Bitmap barcode) {
  statusView.setVisibility(View.GONE);
  viewfinderView.setVisibility(View.GONE);
  resultView.setVisibility(View.VISIBLE);

  ImageView barcodeImageView = (ImageView) findViewById(R.id.barcode_image_view);
  if (barcode == null) {
    barcodeImageView.setImageBitmap(BitmapFactory.decodeResource(getResources(),
        R.drawable.launcher_icon));
  } else {
    barcodeImageView.setImageBitmap(barcode);
  }

  TextView formatTextView = (TextView) findViewById(R.id.format_text_view);
  formatTextView.setText(rawResult.getBarcodeFormat().toString());

  TextView typeTextView = (TextView) findViewById(R.id.type_text_view);
  typeTextView.setText(resultHandler.getType().toString());

  DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
  TextView timeTextView = (TextView) findViewById(R.id.time_text_view);
  timeTextView.setText(formatter.format(new Date(rawResult.getTimestamp())));


  TextView metaTextView = (TextView) findViewById(R.id.meta_text_view);
  View metaTextViewLabel = findViewById(R.id.meta_text_view_label);
  metaTextView.setVisibility(View.GONE);
  metaTextViewLabel.setVisibility(View.GONE);
  Map<ResultMetadataType,Object> metadata = rawResult.getResultMetadata();
  if (metadata != null) {
    StringBuilder metadataText = new StringBuilder(20);
    for (Map.Entry<ResultMetadataType,Object> entry : metadata.entrySet()) {
      if (DISPLAYABLE_METADATA_TYPES.contains(entry.getKey())) {
        metadataText.append(entry.getValue()).append('\n');
      }
    }
    if (metadataText.length() > 0) {
      metadataText.setLength(metadataText.length() - 1);
      metaTextView.setText(metadataText);
      metaTextView.setVisibility(View.VISIBLE);
      metaTextViewLabel.setVisibility(View.VISIBLE);
    }
  }

  TextView contentsTextView = (TextView) findViewById(R.id.contents_text_view);
  CharSequence displayContents = resultHandler.getDisplayContents();
  contentsTextView.setText(displayContents);
  // Crudely scale betweeen 22 and 32 -- bigger font for shorter text
  int scaledSize = Math.max(22, 32 - displayContents.length() / 4);
  contentsTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, scaledSize);

  TextView supplementTextView = (TextView) findViewById(R.id.contents_supplement_text_view);
  supplementTextView.setText("");
  supplementTextView.setOnClickListener(null);
  

  int buttonCount = resultHandler.getButtonCount();
  ViewGroup buttonView = (ViewGroup) findViewById(R.id.result_button_view);
  buttonView.requestFocus();
  for (int x = 0; x < ResultHandler.MAX_BUTTON_COUNT; x++) {
    TextView button = (TextView) buttonView.getChildAt(x);
    if (x < buttonCount) {
      button.setVisibility(View.VISIBLE);
      button.setText(resultHandler.getButtonText(x));
      button.setOnClickListener(new ResultButtonListener(resultHandler, x));
    } else {
      button.setVisibility(View.GONE);
    }
  }

  
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:73,代码来源:CaptureActivity.java


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