- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试重新设计 Q-Municate,但我被抽屉导航重新设计任务困住了
关于此任务,我已经通过 StackOverFlow 给出的每一个可能的解决方案,我还遵循了 here 给出的工作教程但找不到它工作
我的代码附在这里
activity_main.xml
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.valyr.qalam.MainActivity">
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<fragment
android:id="@+id/navigation_drawer"
android:name="com.valyr.qalam.ui.main.NavigationDrawerFragment"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start" />
</android.support.v4.widget.DrawerLayout>
MainActivity.Java
public class MainActivity extends BaseLogeableActivity implements NavigationDrawerFragment.NavigationDrawerCallbacks {
public static final int ID_CHATS_LIST_FRAGMENT = 0;
public static final int ID_CONTACTS_LIST_FRAGMENT = 1;
public static final int ID_INVITE_FRIENDS_FRAGMENT = 2;
public static final int ID_SETTINGS_FRAGMENT = 3;
public static final int ID_FEEDBACK_FRAGMENT = 4;
private static final String TAG = MainActivity.class.getSimpleName();
private NavigationDrawerFragment navigationDrawerFragment;
private FacebookHelper facebookHelper;
private ImportFriends importFriends;
private GSMHelper gsmHelper;
private boolean isNeedToOpenDialog;
private Set<ConnectivityListener> connectivityListeners;
public static void start(Context context) {
PrefsHelper.getPrefsHelper().savePref(PrefsHelper.PREF_PUSH_NOTIFICATIONS_ON_LOGOUT, false);
Intent intent = new Intent(context, MainActivity.class);
context.startActivity(intent);
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
if (navigationDrawerFragment != null) {
prepareMenu(menu);
}
return super.onPrepareOptionsMenu(menu);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (currentFragment instanceof InviteFriendsFragment) {
currentFragment.onActivityResult(requestCode, resultCode, data);
} else if (facebookHelper != null) {
facebookHelper.onActivityResult(requestCode, resultCode, data);
}
}
private void prepareMenu(Menu menu) {
for (int i = 0; i < menu.size(); i++) {
menu.getItem(i).setVisible(!NavigationDrawerFragment.isDrawerOpen());
menu.getItem(i).collapseActionView();
}
}
@Override
public void onNavigationDrawerItemSelected(int position) {
Fragment fragment = null;
switch (position) {
case ID_CHATS_LIST_FRAGMENT:
fragment = DialogsFragment.newInstance();
break;
case ID_CONTACTS_LIST_FRAGMENT:
fragment = FriendsListFragment.newInstance();
break;
case ID_INVITE_FRIENDS_FRAGMENT:
fragment = InviteFriendsFragment.newInstance();
break;
case ID_SETTINGS_FRAGMENT:
fragment = SettingsFragment.newInstance();
break;
case ID_FEEDBACK_FRAGMENT:
fragment = FeedbackFragment.newInstance();
break;
}
if (fragment instanceof ConnectivityListener) {
connectivityListeners.add((ConnectivityListener) fragment);
}
setCurrentFragment(fragment);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
useDoubleBackPressed = true;
connectivityListeners = new HashSet<>();
gsmHelper = new GSMHelper(this);
initNavigationDrawer();
if (!isImportInitialized()) {
showProgress();
facebookHelper = new FacebookHelper(this, savedInstanceState,
new FacebookSessionStatusCallback());
importFriends = new ImportFriends(MainActivity.this, facebookHelper);
PrefsHelper.getPrefsHelper().savePref(PrefsHelper.PREF_SIGN_UP_INITIALIZED, false);
}
initBroadcastActionList();
checkGCMRegistration();
loadFriendsList();
initVideoChat();
}
@Override
protected void onDestroy() {
super.onDestroy();
connectivityListeners.clear();
}
public void removeConnectivityListener(ConnectivityListener listener) {
connectivityListeners.remove(listener);
}
private void initVideoChat() {
QBInitVideoChatCommand.start(this, CallActivity.class);
}
private boolean isImportInitialized() {
PrefsHelper prefsHelper = PrefsHelper.getPrefsHelper();
return prefsHelper.getPref(PrefsHelper.PREF_IMPORT_INITIALIZED, false);
}
private void initBroadcastActionList() {
addAction(QBServiceConsts.LOAD_CHATS_DIALOGS_SUCCESS_ACTION, new LoadDialogsSuccessAction());
addAction(QBServiceConsts.LOAD_FRIENDS_SUCCESS_ACTION, new LoadFriendsSuccessAction());
addAction(QBServiceConsts.LOAD_FRIENDS_FAIL_ACTION, failAction);
addAction(QBServiceConsts.LOAD_CHATS_DIALOGS_FAIL_ACTION, failAction);
addAction(QBServiceConsts.IMPORT_FRIENDS_SUCCESS_ACTION, new ImportFriendsSuccessAction());
addAction(QBServiceConsts.IMPORT_FRIENDS_FAIL_ACTION, new ImportFriendsFailAction());
addAction(QBServiceConsts.LOGIN_AND_JOIN_CHATS_SUCCESS_ACTION, new LoginAndJoinChatsSuccessAction());
}
private void initNavigationDrawer() {
navigationDrawerFragment = (NavigationDrawerFragment) getFragmentManager().findFragmentById(
R.id.navigation_drawer);
navigationDrawerFragment.setUp(R.id.navigation_drawer, (DrawerLayout) findViewById(
R.id.drawer_layout));
}
private void checkGCMRegistration() {
if (gsmHelper.checkPlayServices()) {
if (!gsmHelper.isDeviceRegisteredWithUser(AppSession.getSession().getUser())) {
gsmHelper.registerInBackground();
}
} else {
Log.i(TAG, "No valid Google Play Services APK found.");
}
}
private void loadFriendsList() {
QBLoadFriendListCommand.start(this);
}
private void loadChatsDialogs() {
QBLoadDialogsCommand.start(MainActivity.this);
}
@Override
protected void onResume() {
super.onResume();
gsmHelper.checkPlayServices();
showActionBarProgress();
checkVisibilityProgressBars();
}
@Override
protected void onFailAction(String action) {
hideActionBarProgress();
hideProgress();
if (QBServiceConsts.LOAD_FRIENDS_FAIL_ACTION.equals(action)) {
loadChatsDialogs();
}
}
private void checkVisibilityProgressBars() {
isNeedToOpenDialog = PrefsHelper.getPrefsHelper().getPref(
PrefsHelper.PREF_PUSH_MESSAGE_NEED_TO_OPEN_DIALOG, false);
if (isJoinedToDialogs()) {
hideActionBarProgress();
}
if (isNeedToOpenDialog && !isJoinedToDialogs()) {
hideActionBarProgress();
showProgress();
}
}
private boolean isJoinedToDialogs() {
PrefsHelper prefsHelper = PrefsHelper.getPrefsHelper();
return prefsHelper.getPref(PrefsHelper.PREF_JOINED_TO_ALL_DIALOGS, false);
}
private void startDialog() {
PrefsHelper.getPrefsHelper().savePref(PrefsHelper.PREF_PUSH_MESSAGE_NEED_TO_OPEN_DIALOG, false);
String dialogId = PrefsHelper.getPrefsHelper().getPref(PrefsHelper.PREF_PUSH_MESSAGE_DIALOG_ID, null);
long userId = PrefsHelper.getPrefsHelper().getPref(PrefsHelper.PREF_PUSH_MESSAGE_USER_ID,
ConstsCore.NOT_INITIALIZED_VALUE);
QBDialog dialog = ChatDatabaseManager.getDialogByDialogId(this, dialogId);
if (dialog.getType() == QBDialogType.PRIVATE) {
startPrivateChatActivity(dialog, userId);
} else {
startGroupChatActivity(dialog);
}
}
private void startPrivateChatActivity(QBDialog dialog, long userId) {
User occupantUser = UsersDatabaseManager.getUserById(this, userId);
if (occupantUser != null && userId != ConstsCore.ZERO_INT_VALUE) {
PrivateDialogActivity.start(this, occupantUser, dialog);
}
}
private void importFriendsFinished() {
PrefsHelper.getPrefsHelper().savePref(PrefsHelper.PREF_IMPORT_INITIALIZED, true);
hideProgress();
}
private void startGroupChatActivity(QBDialog dialog) {
GroupDialogActivity.start(this, dialog);
}
@Override
public void onConnectionChange(boolean isConnected) {
super.onConnectionChange(isConnected);
for (ConnectivityListener listener : connectivityListeners) {
listener.onConnectionChange(isConnected);
}
if (currentFragment instanceof FriendsListFragment) {
invalidateOptionsMenu();
}
}
private class LoadDialogsSuccessAction implements Command {
@Override
public void execute(Bundle bundle) {
hideActionBarProgress();
hideProgress();
if (isNeedToOpenDialog) {
startDialog();
}
}
}
private class FacebookSessionStatusCallback implements Session.StatusCallback {
@Override
public void call(Session session, SessionState state, Exception exception) {
if (session.isOpened()) {
importFriends.startGetFriendsListTask(true);
} else if (!(!session.isOpened() && !session.isClosed()) && !isImportInitialized()) {
importFriends.startGetFriendsListTask(false);
hideProgress();
}
}
}
private class LoginAndJoinChatsSuccessAction implements Command {
@Override
public void execute(Bundle bundle) {
loadChatsDialogs();
}
}
private class LoadFriendsSuccessAction implements Command {
@Override
public void execute(Bundle bundle) throws Exception {
loadChatsDialogs();
}
}
private class ImportFriendsSuccessAction implements Command {
@Override
public void execute(Bundle bundle) {
importFriendsFinished();
}
}
private class ImportFriendsFailAction implements Command {
@Override
public void execute(Bundle bundle) {
importFriendsFinished();
}
}
}
NavigationDrawerFragment.Java
public class NavigationDrawerFragment extends BaseFragment {
private static final String STATE_SELECTED_POSITION = "selected_navigation_drawer_position";
private static DrawerLayout drawerLayout;
private static View fragmentContainerView;
private Resources resources;
private ListView drawerListView;
private TextView fullNameTextView;
private ImageButton logoutButton;
private NavigationDrawerCallbacks navigationDrawerCallbacks;
private NavigationDrawerCounterListener navigationDrawerCounterListener;
private ActionBarDrawerToggle drawerToggle;
private int currentSelectedPosition = 0;
private boolean fromSavedInstanceState;
private boolean userLearnedDrawer;
private NavigationDrawerAdapter navigationDrawerAdapter;
private BroadcastReceiver countUnreadDialogsBroadcastReceiver;
public static boolean isDrawerOpen() {
return drawerLayout != null && drawerLayout.isDrawerOpen(fragmentContainerView);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
resources = getResources();
initPrefValues();
if (savedInstanceState != null) {
currentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION);
fromSavedInstanceState = true;
}
selectItem(currentSelectedPosition);
initLocalBroadcastManagers();
}
private void initLocalBroadcastManagers() {
countUnreadDialogsBroadcastReceiver = new CountUnreadDialogsBroadcastReceiver();
LocalBroadcastManager.getInstance(baseActivity).registerReceiver(countUnreadDialogsBroadcastReceiver,
new IntentFilter(QBServiceConsts.GOT_CHAT_MESSAGE));
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_navigation_drawer, container, false);
initUI(rootView);
initListeners();
initNavigationAdapter();
drawerListView.setItemChecked(currentSelectedPosition, true);
return rootView;
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
navigationDrawerCallbacks = (NavigationDrawerCallbacks) activity;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setHasOptionsMenu(true);
baseActivity.getActionBar().setDisplayShowHomeEnabled(true);
}
@Override
public void onResume() {
super.onResume();
QBUser user = AppSession.getSession().getUser();
if (user != null) {
fullNameTextView.setText(user.getFullName());
}
addActions();
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putInt(STATE_SELECTED_POSITION, currentSelectedPosition);
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
drawerToggle.onConfigurationChanged(newConfig);
}
@Override
public void onDetach() {
super.onDetach();
navigationDrawerCallbacks = null;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
return drawerToggle.onOptionsItemSelected(item) || super.onOptionsItemSelected(item);
}
public void setUp(int fragmentId, final DrawerLayout drawerLayout) {
fragmentContainerView = baseActivity.findViewById(fragmentId);
NavigationDrawerFragment.drawerLayout = drawerLayout;
drawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
ActionBar actionBar = baseActivity.getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);
drawerToggle = new QMActionBarDrawerToggle(baseActivity, drawerLayout, R.drawable.ic_drawer,
R.string.nvd_open, R.string.nvd_close);
if (!userLearnedDrawer && !fromSavedInstanceState) {
drawerLayout.openDrawer(fragmentContainerView);
}
drawerLayout.post(new Runnable() {
@Override
public void run() {
drawerToggle.syncState();
}
});
drawerLayout.setDrawerListener(drawerToggle);
}
private void initPrefValues() {
PrefsHelper prefsHelper = PrefsHelper.getPrefsHelper();
userLearnedDrawer = prefsHelper.getPref(PrefsHelper.PREF_USER_LEARNED_DRAWER, false);
// Set base value of droverLayout as opposite to userLearnerDrawer
// Made it for next behaviour: if drawer will be opened then we shouldn't show croutons
prefsHelper.savePref(PrefsHelper.PREF_CROUTONS_DISABLED, !userLearnedDrawer);
}
private void selectItem(int position) {
currentSelectedPosition = position;
if (drawerListView != null) {
drawerListView.setItemChecked(position, true);
}
if (drawerLayout != null) {
drawerLayout.closeDrawer(fragmentContainerView);
}
if (navigationDrawerCallbacks != null) {
navigationDrawerCallbacks.onNavigationDrawerItemSelected(position);
}
}
private void initNavigationAdapter() {
navigationDrawerAdapter = new NavigationDrawerAdapter(baseActivity, getNavigationDrawerItems());
drawerListView.setAdapter(navigationDrawerAdapter);
navigationDrawerCounterListener = navigationDrawerAdapter;
}
private void initUI(View rootView) {
drawerListView = (ListView) rootView.findViewById(R.id.navigation_listview);
logoutButton = (ImageButton) rootView.findViewById(R.id.logout_imagebutton);
fullNameTextView = (TextView) rootView.findViewById(R.id.fullname_textview);
}
private void initListeners() {
drawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, final View view, final int position, long id) {
selectItem(position);
}
});
logoutButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
logout();
}
});
}
private List<String> getNavigationDrawerItems() {
String[] itemsArray = resources.getStringArray(R.array.nvd_items_array);
return Arrays.asList(itemsArray);
}
private void logout() {
ConfirmDialog dialog = ConfirmDialog.newInstance(R.string.dlg_logout, R.string.dlg_confirm);
dialog.setPositiveButton(new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Stop porcess push notifications after logout
PrefsHelper.getPrefsHelper().savePref(PrefsHelper.PREF_PUSH_NOTIFICATIONS_ON_LOGOUT, true);
// Start clear messages that was not sent
ChatDatabaseManager.deleteAllNotSendMessages(getActivity().getApplicationContext());
baseActivity.showProgress();
FacebookHelper.logout();
// Clear crouton queue
Crouton.cancelAllCroutons();
QBLogoutCommand.start(baseActivity);
}
});
dialog.show(getFragmentManager(), null);
}
private void addActions() {
baseActivity.addAction(QBServiceConsts.LOGOUT_SUCCESS_ACTION, new LogoutSuccessAction());
baseActivity.addAction(QBServiceConsts.LOGOUT_FAIL_ACTION, failAction);
baseActivity.updateBroadcastActionList();
}
private void saveUserLearnedDrawer() {
PrefsHelper.getPrefsHelper().savePref(PrefsHelper.PREF_USER_LEARNED_DRAWER, true);
}
private int getCountUnreadDialogs() {
return ChatDatabaseManager.getCountUnreadDialogs(baseActivity);
}
public interface NavigationDrawerCallbacks {
void onNavigationDrawerItemSelected(int position);
}
public interface NavigationDrawerCounterListener {
void onUpdateCountUnreadDialogs(int count);
}
private class CountUnreadDialogsBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Bundle extras = intent.getExtras();
if (extras != null) {
navigationDrawerCounterListener.onUpdateCountUnreadDialogs(getCountUnreadDialogs());
}
}
}
private class QMActionBarDrawerToggle extends ActionBarDrawerToggle {
public QMActionBarDrawerToggle(Activity activity, DrawerLayout drawerLayout, int drawerImageRes,
int openDrawerContentDescRes, int closeDrawerContentDescRes) {
super(activity, drawerLayout, drawerImageRes, openDrawerContentDescRes,
closeDrawerContentDescRes);
}
@Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
// Clear croutons
PrefsHelper.getPrefsHelper().savePref(PrefsHelper.PREF_CROUTONS_DISABLED, true);
Crouton.clearCroutonsForActivity(getActivity());
baseActivity.invalidateOptionsMenu();
if (!userLearnedDrawer) {
userLearnedDrawer = true;
saveUserLearnedDrawer();
}
navigationDrawerCounterListener.onUpdateCountUnreadDialogs(getCountUnreadDialogs());
}
@Override
public void onDrawerClosed(View drawerView) {
super.onDrawerClosed(drawerView);
baseActivity.invalidateOptionsMenu();
PrefsHelper.getPrefsHelper().savePref(PrefsHelper.PREF_CROUTONS_DISABLED, false);
}
}
private class LogoutSuccessAction implements Command {
@Override
public void execute(Bundle bundle) {
LandingActivity.start(baseActivity);
baseActivity.finish();
}
}
}
fragment_navigation_drawer.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:clickable="true"
android:focusable="false">
<ListView
android:id="@+id/navigation_listview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/footer_linearlayout"
android:layout_alignParentTop="true"
android:background="@null"
android:choiceMode="singleChoice"
android:divider="@android:color/darker_gray"
android:dividerHeight="1dp"
tools:context="com.sample.app.NavigationDrawerFragment" />
<LinearLayout
android:id="@id/footer_linearlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:padding="5dp">
<com.valyr.qalam.utils.ArabicTextView
android:id="@+id/fullname_textview"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:textColor="@color/link_text_color"
android:textSize="@dimen/text_size_small" />
<ImageButton
android:id="@+id/logout_imagebutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:background="@drawable/button_general_selector"
android:padding="10dp"
android:src="@drawable/ic_logout" />
</LinearLayout>
</RelativeLayout>
主题和操作栏与一切都紧密相关,所以我无法从样式中触及任何东西,但我真的需要一个技巧来完成它。请帮忙
注意:这个问题根本不可能重复,因为这里给出的所有解决方案都使用 AppCompact 和 Toolbar,请在投票前仔细阅读问题
最佳答案
在常规 Activity
中,ActionBar
是覆盖层 View
的一部分,它是 Window< 的唯一直接子级
的 DecorView
。您可以从 DecorView
中移除此子项,将 activity_main
主布局膨胀到 DecorView
中,然后添加叠加层 View
到 DrawerLayout
的 FrameLayout
,有效地将抽屉置于所有内容之上。
为了避免更改 BaseLogeableActivity
类,我们需要更改 DrawerLayout
的 FrameLayout
的 ID,并确保存在 container
的资源 ID,以分配给动态创建的 FrameLayout
,它将保存 Fragment
。
如有必要,创建容器
的资源ID:
<item type="id" name="container" />
更改主布局的FrameLayout
的ID:
<FrameLayout
android:id="@+id/overlay_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
添加 View
杂耍代码的最干净的方法可能就是覆盖 MainActivity
的 setContentView()
方法,如下所示:
@Override
public void setContentView(int layoutResID) {
ViewGroup decorView = (ViewGroup) getWindow().getDecorView();
View overlayView = decorView.getChildAt(0);
decorView.removeView(overlayView);
getLayoutInflater().inflate(layoutResID, decorView, true);
FrameLayout overlayContainer = (FrameLayout) findViewById(R.id.overlay_container);
overlayContainer.addView(overlayView);
FrameLayout container = new FrameLayout(this);
container.setId(R.id.container);
ViewGroup content = (ViewGroup) overlayView.findViewById(android.R.id.content);
content.addView(container);
}
最后,如果您希望您的 Activity
覆盖状态栏,请将以下属性设置添加到其主题中:
<item name="android:windowFullscreen">true</item>
或者,由于您无法更改主题,请在 setContentView()
调用之前调用以下代码:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
关于android - 像 Android 5.0 一样在 ActionBar/StatusBar 顶部的抽屉导航而不使用 AppCompact/ToolBar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35150125/
我在我的应用程序中设置了一个操作栏。我通过调用 Activity.getActionBar() 取回 ActionBar .然后我设置了我需要的所有选项卡感谢 ActionBar.addTab()和
我正在为 Android 平板电脑 (XOOM) 开发应用程序,我想知道是否可以将操作栏放在屏幕底部,而不是顶部(这是默认选项) . 谢谢。 最佳答案 如果您在 Activity 中获取 Action
我很想为我用“ActionBar Sherlock”库导入的 ActionBar 设置一个背景图像。但是,我在 Internet 上找不到任何有关如何使用 XML 独特地设置 BackgroundIm
我需要在栏下方显示子菜单,而不是在栏本身的顶部。 复制下面我的 actionbar xml 在activity中(
我已经阅读了 AppCompat 库中的工具栏及其所有功能。我在 android 开发者博客 (here) 中注意到的一些事情是: Toolbar is fully supported in AppC
我试图做一个 Espresso 测试来检查 actionbar 是否隐藏/显示,但我似乎无法弄清楚如何将它与 Espresso.onView(...) 匹配。 Afaik它没有ID,对吧? 非常感谢
我们怎样才能让操作栏和操作栏选项卡变成纯白色。我正在使用 android-support-v7-appcompat 库来支持向后兼容性。 style/Theme.AppCompat.Light.Dar
在 Galaxy S3 上,我遇到一个问题,即 ActionBar 中的一个按钮被配置为 showAsAction="always"并且同时显示在硬件溢出菜单和操作按钮上。我希望它不显示在硬件溢出菜单
我正在学习教程 https://www.youtube.com/watch?v=VVahIc8yENk我得到了错误 java.lang.NullPointerException: Attempt to
背景 我希望在 PreferenceActivity 上显示一个 ActionBar,因为它不适用于 Honeycomb 之前的设备(即使在支持库中)。 因为这样的类在支持库中不可用,所以我不能只调用
我想实现将下载数据并将其设置到 ActionBar 选项卡中的应用程序。我已经实现了它,但我还有一件事要做。我试过添加操作栏列表,像这样 one , 但 android 不允许同时使用 Tabs 和
我希望我的 ActionBar 和 Tabs 看起来像这样。 请忽略颜色 目前看起来是这样 由于我的主题,我必须在 java 中设置自定义 ActionBar。 actionBar.setDispla
我目前正在某些页面上设置 ActionBar 副标题,但在某些页面上我不想有副标题。 我可以简单地将字幕文本设置为空,但这只会删除文本。它仍然占据字幕空间,从而将标题推高。可能很难解释,所以我用图片说
import android.app.ActionBar; import android.app.FragmentTransaction; import android.content.Intent;
我正在使用 ActionBarSherlock ,并尝试隐藏/显示全屏图像的 ActionBar,使用: getSupportActionBar.hide(); 和 getSupportActionB
我在我的简单应用程序上使用 ActionBarSherlock,如果用户在主页/主要 Activity 中,我想隐藏主页按钮。我了解如何使用 setHomeButtonEnabled(false) 执
我发现自己在 3 个单独的 Activity 中为我的 actionBar (actionBarSherlock) 列表重写了相同的代码。所有 3 个都使用相同的 actionBar,它有 3 个项目
我正在使用 ActionBarSherlock 在关于 ActionBar 标签高度的类似问题中,我使用了: @style/blah1 @style/blah2 80dp .
我一直在寻找是否有任何关于如何始终在 ActionBar 下方显示 ActionBar 选项卡的信息,即使当手机横向时也是如此。我知道它会根据屏幕上是否有足够的空间来自动将选项卡放置在 ActionB
我在 ActionBar 上方显示的 ActionBar Tabs 出现了这种奇怪的行为。当我为 ActionBar 设置自定义 View 时,这恰好发生了。我正在使用 Roman Nurik 的示例
我是一名优秀的程序员,十分优秀!