Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/209.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 运动事件的指针计数0无效>&燃气轮机;在导航抽屉中打开/关闭/选择_Android_Navigation Drawer_Motionevent - Fatal编程技术网

Android 运动事件的指针计数0无效>&燃气轮机;在导航抽屉中打开/关闭/选择

Android 运动事件的指针计数0无效>&燃气轮机;在导航抽屉中打开/关闭/选择,android,navigation-drawer,motionevent,Android,Navigation Drawer,Motionevent,如果我对导航抽屉执行任何操作,就会出现此错误 Motion event has invalid pointer count 0; value must be between 1 and 16. 此错误不会使我的活动崩溃。但只是淹没了我的日志。下面是活动。适配器是在一行中包含图像和文本的自定义适配器 public class FirstActivity extends AppCompatActivity implements AdapterView.OnItemClickListener { p

如果我对导航抽屉执行任何操作,就会出现此错误

Motion event has invalid pointer count 0; value must be between 1 and 16.
此错误不会使我的活动崩溃。但只是淹没了我的日志。下面是活动。适配器是在一行中包含图像和文本的自定义适配器

public class FirstActivity extends AppCompatActivity implements AdapterView.OnItemClickListener {
private DrawerLayout drawerLayout;
private ActionBarDrawerToggle actionBarDrawerToggle;
private ListView navList;
private NavAdapter navAdapter;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_first);

    drawerLayout = (DrawerLayout)findViewById(R.id.drawerLayout);
    navList = (ListView)findViewById(R.id.navigation_list);
    navAdapter = new NavAdapter(this);
    navList.setAdapter(navAdapter);
    navList.setOnItemClickListener(this);
    actionBarDrawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.opendrawer, R.string.closedrawer);

    drawerLayout.setDrawerListener(actionBarDrawerToggle);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if(actionBarDrawerToggle.onOptionsItemSelected(item)){
        return true;
    }
    return super.onOptionsItemSelected(item);
}

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    actionBarDrawerToggle.onConfigurationChanged(newConfig);
}

@Override
public void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    actionBarDrawerToggle.syncState();
}

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    navList.setItemChecked(position, true);
    String menuItem = (((TextView)view.findViewById(R.id.drawerTV)).getText().toString());
    getSupportActionBar().setTitle(menuItem);
}
}
公共类FirstActivity扩展AppCompative实现AdapterView.OnItemClickListener{
私人抽屉布局;
私人动作bardrawertoggle动作bardrawertoggle;
私有列表视图导航列表;
专用导航适配器;
@凌驾
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_优先);
抽屉布局=(抽屉布局)findViewById(R.id.抽屉布局);
navList=(ListView)findViewById(R.id.navigation\u列表);
navAdapter=新的navAdapter(本);
setAdapter(navAdapter);
setOnItemClickListener(this);
actionBarDrawerToggle=新actionBarDrawerToggle(this,drawerLayout,R.string.opendrawer,R.string.closedrawer);
抽屉布局。setDrawerListener(actionBarDrawerToggle);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
@凌驾
公共布尔值onOptionsItemSelected(菜单项项){
如果(actionBarDrawerToggle.onOptionsItemSelected(项目)){
返回true;
}
返回super.onOptionsItemSelected(项目);
}
@凌驾
公共无效OnConfiguration已更改(配置newConfig){
super.onConfigurationChanged(newConfig);
actionBarDrawerToggle.onConfigurationChanged(newConfig);
}
@凌驾
后期创建时的公共无效(捆绑保存状态){
super.onPostCreate(savedInstanceState);
actionBarDrawerToggle.syncState();
}
@凌驾
public void onItemClick(AdapterView父对象、视图、整型位置、长id){
navList.setItemChecked(位置,真);
字符串menuItem=(((TextView)view.findviewbyd(R.id.drawerTV)).getText().toString());
getSupportActionBar().setTitle(菜单项);
}
}

谢谢。它帮助我找到了错误的原因,但没有提供解决方案。