當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。