android.widget.GridView.requestFocus()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(139)

本文整理了Java中android.widget.GridView.requestFocus()方法的一些代码示例,展示了GridView.requestFocus()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GridView.requestFocus()方法的具体详情如下:
包路径:android.widget.GridView
类名称:GridView
方法名:requestFocus

GridView.requestFocus介绍

暂无

代码示例

代码示例来源:origin: novoda/android-demos

@Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    GridView gridView = (GridView) inflater.inflate(R.layout.gridview, null);
    gridView.setAdapter(new GridViewAdapter(mContext));
    gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
      public void onItemClick(AdapterView<?> l, View v, int position, long id) {
      }
    });
    gridView.requestFocus();
    return gridView;
  }
}

代码示例来源:origin: stackoverflow.com

GridView v = (GridView) findViewById(R.id.grid); 

v.requestFocus();

代码示例来源:origin: stackoverflow.com

private void showGridDialog() {
     // Prepare grid view
 final GridView bv = (GridView) 
  dialogueBill.findViewById(R.id.gridBillView);
  ba = new BillAdapter(this, ParseData.BillList);
  bv.findFocus();
  bv.setAdapter(ba);
  bv.setFocusableInTouchMode(true);
  bv.requestFocus();
  bv.setClickable(true);
  bv.setFocusable(true);
     bv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
       @Override
       public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
         // do something here
       }
     });
     // Set grid view to alertDialog
     AlertDialog.Builder builder = new AlertDialog.Builder(this);
     builder.setView(bv);
     builder.setTitle("Goto");
     builder.show();
   }

代码示例来源:origin: MoMoWait/LeanbackLauncher

public void preformIconMoreClick(){
  int itemCount = mList.getChildCount();
  int selectedPosition = mList.getSelectedPosition();
  ArrayList<HomeScreenRow> visibleRows = mHomeAdapter.getVisRowList();
  for(int i = 0; i < itemCount; ++i){
    View rowView =  visibleRows.get(i).getRowView();
    if(rowView instanceof ActiveFrame && i != selectedPosition){
      rowView.setVisibility(View.GONE);
    }
  }
  mAllAppGridView.setVisibility(View.VISIBLE);
  mAllLaunchPoints = mLaunchPointListGenerator.getAllLaunchPoints();
  mAllAppGridAdapter = new AllAppGridAdapter(this, R.layout.adapter_item_allapp, mAllLaunchPoints);
  mAllAppGridView.setAdapter(mAllAppGridAdapter);
  mAllAppGridView.setOnItemClickListener(this);
  mAllAppGridView.setFocusable(true);
  mAllAppGridView.setFocusableInTouchMode(true);
  mAllAppGridView.requestFocus();
}

相关文章

GridView类方法