本文整理汇总了Java中android.widget.GridView.setEmptyView方法的典型用法代码示例。如果您正苦于以下问题:Java GridView.setEmptyView方法的具体用法?Java GridView.setEmptyView怎么用?Java GridView.setEmptyView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.GridView
的用法示例。
在下文中一共展示了GridView.setEmptyView方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onViewCreated
import android.widget.GridView; //导入方法依赖的package包/类
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
final GridView gridView = findAdapterView();
gridView.setEmptyView(getEmptyView());
gridView.setOnItemClickListener(this);
}
示例2: onCreate
import android.widget.GridView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayUseLogoEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
getSupportActionBar().setIcon(R.drawable.ic_logo_botanist);
}
FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
/**
* Handle action button click
* @param view - current view
*/
@Override
public void onClick(View view) {
startActivity(new Intent(MainActivity.this, NewPlantActivity.class));
}
});
View tipView = findViewById(R.id.daily_tip_cardview);
tipView.findViewById(R.id.daily_tip_dismiss_button).setOnClickListener(new View.OnClickListener() {
/**
* change visibility of CardView to gone if user clicked "Dismiss" button
* @param v - the view
*/
@Override
public void onClick(View v) {
findViewById(R.id.daily_tip_cardview).setVisibility(View.GONE);
}
});
GridView gridView = findViewById(R.id.plants_grid);
gridView.setEmptyView(findViewById(R.id.empty_grid_view));
mController = new MainController(this);
AppRater.INSTANCE.appLaunched(this);
}
示例3: onCreate
import android.widget.GridView; //导入方法依赖的package包/类
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_features);
final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_actionbar);
setSupportActionBar(toolbar);
// ensure that Bluetooth exists
if (!ensureBLEExists())
finish();
final DrawerLayout drawer = mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
// Set the drawer toggle as the DrawerListener
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open, R.string.drawer_close) {
@Override
public void onDrawerSlide(final View drawerView, final float slideOffset) {
// Disable the Hamburger icon animation
super.onDrawerSlide(drawerView, 0);
}
};
drawer.setDrawerListener(mDrawerToggle);
// setup plug-ins in the drawer
setupPluginsInDrawer((ViewGroup) drawer.findViewById(R.id.plugin_container));
// configure the app grid
final GridView grid = (GridView) findViewById(R.id.grid);
grid.setAdapter(new AppAdapter(this));
grid.setEmptyView(findViewById(android.R.id.empty));
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}