-1
enter image description here很新到Android studio.I要在其中创建的Android studio.Please底栏提供一些想法create.i附在这里像那样的Android的工作室 - 创建底栏
enter image description here很新到Android studio.I要在其中创建的Android studio.Please底栏提供一些想法create.i附在这里像那样的Android的工作室 - 创建底栏
Check this link Android new Bottom Navigation bar
public class MainActivity extends AppCompatActivity {
private BottomBar mBottomBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Notice how you don't use the setContentView method here! Just
// pass your layout to bottom bar, it will be taken care of.
// Everything will be just like you're used to.
mBottomBar = BottomBar.bind(this, R.layout.activity_main,
savedInstanceState);
mBottomBar.setItems(
new BottomBarTab(R.drawable.ic_recents, "Recents"),
new BottomBarTab(R.drawable.ic_favorites, "Favorites"),
new BottomBarTab(R.drawable.ic_nearby, "Nearby"),
new BottomBarTab(R.drawable.ic_friends, "Friends")
);
mBottomBar.setOnItemSelectedListener(new OnTabSelectedListener() {
@Override
public void onItemSelected(final int position) {
// the user selected a new tab
}
});
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
mBottomBar.onSaveInstanceState(outState);
}
}
编译'com.android.support:design:25.0.0' 我可以在哪里添加这一行。 –
在您的项目gradle –
错误:(24,13)无法解决:compile'com.android.support:design:25.0.0' Show in File –