- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在添加 Material 抽屉Material Drawer并制作了一个方法 addNavigationDrawer 来添加抽屉导航并在我从 Firebase Firestore 数据库中获取用户详细信息后调用该方法(您可以在 OnCreate 方法下的 Auth Listener 中找到它)但是在第一次打开此 Activity 时,操作栏被切割为你可以在图像中看到但是当我将它最小化并再次打开它时,它工作得非常好。请建议该怎么做?
这里是Activity的完整代码
public class Main2Activity extends AppCompatActivity {
ProfileInformationDialog profileInformationDialog;
FirebaseAuth firebaseAuth;
FirebaseAuth.AuthStateListener authStateListener;
FirebaseFirestore db;
DocumentReference documentReference;
Button button;
GoogleApiClient googleApiClient;
/*@BindView(R.id.toolbar)
Toolbar toolbar;*/
ProgressDialog progressDialog;
String user_name,shop_name;
Toolbar toolbar;
Drawer result;
AccountHeader headerResult;
@Override
public void onStart()
{
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.build();
googleApiClient = new GoogleApiClient.Builder(this)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.build();
googleApiClient.connect();
super.onStart();
firebaseAuth.addAuthStateListener(authStateListener);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
toolbar = (Toolbar)findViewById(R.id.toolbar);
toolbar.setTitle("Hello");
setSupportActionBar(toolbar);
//DrawerUtil.getDrawer(Main2Activity.this,toolbar);
//addNavigationDrawer();
progressDialog = new ProgressDialog(this);
db = FirebaseFirestore.getInstance();
profileInformationDialog = new ProfileInformationDialog(this);
FacebookSdk.sdkInitialize(getApplicationContext());
AppEventsLogger.activateApp(this);
ButterKnife.bind(this);
button = (Button) findViewById(R.id.log_out);
firebaseAuth = FirebaseAuth.getInstance();
authStateListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
final FirebaseUser firebaseUser = firebaseAuth.getCurrentUser();
if (firebaseUser != null) {
progressDialog.setMessage("Loading...");
progressDialog.show();
progressDialog.setCancelable(false);
//User is signed in
documentReference = db.collection("Users").document(firebaseUser.getUid());
documentReference.get().addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() {
@Override
public void onSuccess(DocumentSnapshot documentSnapshot)
{
if (documentSnapshot != null && documentSnapshot.exists()) {
progressDialog.hide();
User user1 = documentSnapshot.toObject(User.class);
user_name = user1.getName();
shop_name = user1.getShop_name();
addNavigationDrawer();
//DrawerUtil.getDrawer(Main2Activity.this,toolbar);
headerResult.updateProfile(new ProfileDrawerItem().withIcon(R.drawable.logout_icon256).withName(user_name));
Toast.makeText(Main2Activity.this, "Document Exists", Toast.LENGTH_SHORT).show();
}
else
{
progressDialog.hide();
Toast.makeText(Main2Activity.this, "No Such Document", Toast.LENGTH_SHORT).show();
profileInformationDialog.show();
profileInformationDialog.setCancelable(false);
}
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e)
{
progressDialog.hide();
Toast.makeText(Main2Activity.this, "Exception " + e, Toast.LENGTH_SHORT).show();
}
});
Log.d("TAG", "onAuthStateChanged:signed_in:" + firebaseUser.getUid());
} else {
// User is signed out
Log.d("TAG", "onAuthStateChanged:signed_out");
}
}
};
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Auth.GoogleSignInApi.signOut(googleApiClient).setResultCallback(
new ResultCallback<Status>() {
@Override
public void onResult(@NonNull Status status)
{
//Toast.makeText(getApplicationContext(),"Google Logged Out",Toast.LENGTH_SHORT).show();
}
});
firebaseAuth.signOut();
LoginManager.getInstance().logOut();
startActivity(new Intent(Main2Activity.this,SignInActivity.class));
finish();
}
});
}
private void addNavigationDrawer()
{
headerResult = new AccountHeaderBuilder()
.withActivity(this)
.withHeaderBackground(R.drawable.curve_shape)
.withSelectionListEnabledForSingleProfile(true)
.addProfiles(
new ProfileDrawerItem().withName(user_name).withIcon(R.drawable.logout_icon256)
)
.withOnAccountHeaderListener(new AccountHeader.OnAccountHeaderListener() {
@Override
public boolean onProfileChanged(View view, IProfile profile, boolean currentProfile)
{
Toast.makeText(Main2Activity.this, profile.getName() + "", Toast.LENGTH_SHORT).show();
return false;
}
})
.build();
PrimaryDrawerItem makeBillItem = new PrimaryDrawerItem().withIdentifier(1)
.withName("Make new Bill");
SecondaryDrawerItem logoutItem = new SecondaryDrawerItem().withIdentifier(2)
.withName("Log Out").withIcon(R.drawable.logout_icon256);
result = new DrawerBuilder()
.withAccountHeader(headerResult)
.withActivity(this)
.withToolbar(toolbar)
.withTranslucentStatusBar(false)
.withDisplayBelowStatusBar(false)
.withActionBarDrawerToggle(true)
.withActionBarDrawerToggleAnimated(true)
.withCloseOnClick(true)
.withSelectedItem(-1)
.addDrawerItems(
makeBillItem,
new DividerDrawerItem(),
logoutItem
)
.withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
@Override
public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
Toast.makeText(Main2Activity.this, position + " = position", Toast.LENGTH_SHORT).show();
return true;
}
})
.build();
}
@Override
public void onStop() {
super.onStop();
if (firebaseAuth != null) {
firebaseAuth.removeAuthStateListener(authStateListener);
}
}
最佳答案
step 1 add this style to value/style
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
step 2 add this style to value/style-v21
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
step 3 and change your layout
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:id="@+id/drawer_layout"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.visky.railway.sec.ui.activity.MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
-----------here your layout content---------------
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>
step 4 add theme to manifest.xml
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar"/>
关于android - 工具栏从顶部切割。如何显示完整的工具栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47069169/
具体详细介绍请看下文: 在使用文件进行交互数据的应用来说,使用FTP服务器是一个很好的选择。本文使用Apache Jakarta Commons Net(commons-net-3.3.jar)
我在日志文件中收到这些警告: WARN 2013-01-15 00:08:15,550 org.eclipse.jetty.http.HttpParser- HttpParser Full for
我在使用特定网页时遇到问题。当我按下链接时,我收到应用程序错误(不是 http 错误等,而是应用程序级别错误)。 但是我打开了开发人员工具和网络控制台,我看到没有请求发送到服务器。 所以我双击并选择查
我没有组装经验,但这是我一直在做的。如果在通过程序集中的指针传递参数和调用函数时缺少任何基本方面,我希望输入。 例如,我想知道是否应该还原ecx,edx,esi,edi,。我读到它们是通用寄存器,但我
我没有组装经验,但这是我一直在做的。如果在通过程序集中的指针传递参数和调用函数时缺少任何基本方面,我希望输入。 例如,我想知道是否应该还原ecx,edx,esi,edi,。我读到它们是通用寄存器,但我
我正在尝试创建完整 uiscrollview 的快照,所有内容大小,我已经搜索了很多,并且我在 SO 上找到了一些东西,如下所示: Getting a screenshot of a UIScroll
我想复制一个包含以下结构的Vector,对我来说重要的是在修改复制的 vector 时保持原始Vector完整: public class objet_poid_n { public int
给定一个示例字符串 s = '嗨,我的名字是 Humpty-Dumpty,来自“爱丽丝,爱丽丝镜中奇遇记”',我想将其分成以下 block : # To Do: something like {l =
已关闭。此问题旨在寻求有关书籍、工具、软件库等的建议。不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以
我正在尝试创建一个正则表达式来查找文本中的 Linux 文件路径,但是正则表达式对我来说非常陌生。我有下面的代码片段,它将识别下面文件结构的开头。 .*(/bin/|/home/).* 完成正则表达式
我正在寻找远程托管的 JPG 的尺寸、宽度和高度。我已经了解了如何通过下载完整图像来执行此操作。 但是,如果我可以通过仅下载足以获取此信息的方式来做到这一点,那将是理想的。 典型的图像大小为 200K
有没有办法让下面的代码: import traceback def log(message): print "%s: %s" %(traceback.extract_stack()[0:-1]
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 3 年前。 Improve this qu
git show 显示了修订版中所做的所有更改。但是,它会打印出所有更改——而不仅仅是文件名。 git show --stat 只显示文件名,但它把它们截断了!有没有办法获得已更改文件名的完整列表?
Closed. This question does not meet Stack Overflow guidelines。它当前不接受答案。 想要改善这个问题吗?更新问题,以便将其作为on-topi
当我在模板中调用我的模型 get_absolute_url 方法时,我想要一个绝对/完整的 url。在我的入门模型中,我有以下内容: def get_absolute_url(self): r
我正在使用 jQuery 1.5.1 这是我的代码: $('.cellcontent').animate({ left: '-=190'}, { easing: alert('start
我正在使用下面的方法删除条形图并使用新数据更新条形图,但这样做时出现了一个小故障/完整的图表消失 1 秒,直到加载新数据。但是是否可以通过仅增加/减少柱形而不实际消失图表来实现相同的目的。 d3.se
基于 this question 中的讨论,任何人都可以提供代码或代码链接,显示 NumericLiteralX 模块的完整实现(例如 this one )?我对 NumericLiteralX 模块
我的目标是检索网站的 html,并将其转换为可读的String。我下面的代码可以工作,但我遇到了一个技术问题:当我尝试检索 http://time.gov/HTML5 的 html 时,我在 andr
我是一名优秀的程序员,十分优秀!