最新回答 / 慕粉3149298
因为“LinearLayout toastLayout = (LinearLayout) toast.getView();”这句中的“ toast.getView();”在创建linear的时候就已经是toast的布局了,而“addView”则是给布局添加组件。
2016-05-18
registerForContextMenu(listview);
public void onCreateConetxtMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo){
菜单标题, 图标, 菜单项(menu.add()/getMenuInflater().inflater())
}
public void onContextItemsSelected(MenuItem item){
}
public void onCreateConetxtMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo){
菜单标题, 图标, 菜单项(menu.add()/getMenuInflater().inflater())
}
public void onContextItemsSelected(MenuItem item){
}
2016-04-28
OptionsMenu对应的activity,一个activity只能拥有一个选项菜单;
ContextMenu对应的是View,每个View都可以设置上下文菜单;
一般情况下ContextMenu常用于ListView或者GridView;
ContextMenu对应的是View,每个View都可以设置上下文菜单;
一般情况下ContextMenu常用于ListView或者GridView;
2016-04-28
MenuItem item = menu.add(1, BITCH, 1, "猪队友");
item.setTitle("实在是坑");
item.setIcon(R.mipmap.fuck);
case BITCH:
Toast.makeText(MainActivity.this, item.getText().toString()+"bitch").show();
startActivity(new Intent(MainActivity.this, SecondActivity.class));
item.setTitle("实在是坑");
item.setIcon(R.mipmap.fuck);
case BITCH:
Toast.makeText(MainActivity.this, item.getText().toString()+"bitch").show();
startActivity(new Intent(MainActivity.this, SecondActivity.class));
2016-04-28