android.widget.ListView.setDescendantFocusability()方法的使用及代码示例

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

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

ListView.setDescendantFocusability介绍

暂无

代码示例

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

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
  super.onViewCreated(view, savedInstanceState);
  final ListView lv = getListView();
  lv.setDescendantFocusability(ListView.FOCUS_AFTER_DESCENDANTS);
}

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

private boolean fixedAlready = false;
private void fixListViewFocusability(View v)
{
  if (fixedAlready)
    return;

  Log.d(at_data.TAG, "Trying to fix focus issues from " + v);

  ViewGroup vg = (ViewGroup) v.getParent();
  while (vg != null)
  {
    if (vg instanceof ListView)
    {
      Log.d(at_data.TAG, "Found list view " + vg);
      ListView lv = (ListView) vg;

      fixedAlready = true;
      lv.setDescendantFocusability(ListView.FOCUS_AFTER_DESCENDANTS);

      break;
    }

    vg = (ViewGroup) vg.getParent();
  }
}

代码示例来源:origin: quemb/QMBForm

listView.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  @Override

代码示例来源:origin: shanyao0/SimpleApp

/**
 * 初始化PullToRefresh
 */
public void initPullToRefresh() {
  refreshListView = (PullToRefreshListView) View.inflate(getActivity(),
      R.layout.ptr_listview, null);
  refreshListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener<ListView>() {
    /**
     * 上拉刷新和下拉加载更多都会执行该方法
     */
    @Override
    public void onRefresh(final PullToRefreshBase<ListView> refreshView) {
      // 下拉刷新
      if (refreshListView.getCurrentMode() == PullToRefreshBase.Mode.PULL_FROM_START) {
            setRefresh();// 下拉刷新
      }
      // 上拉加载更多
      else {
        // 加载更多
        loadMore();
      }
    }
  });
  listView = refreshListView.getRefreshableView();
  listView.setDividerHeight(0);
  listView.setSelector(android.R.color.transparent);
  listView.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
}
/**

相关文章

ListView类方法