小编cha*_*nti的帖子

当我在android中滚动内容时如何隐藏ToolBar

我正在尝试隐藏我的工具栏,当我滚动我的文本和图像与内容,这里我使用scrollView获取滚动内容时,当我滚动内容如何隐藏工具栏请任何人告诉我如何获得

这是我的XMl代码

content_main.XML

<android.support.v4.widget.NestedScrollView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
app:layout_behavior="@string/appbar_scrolling_view_behavior">


<LinearLayout
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

<LinearLayout
    android:paddingTop="?android:attr/actionBarSize"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:id="@+id/textone"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:textSize="23dp"
        android:textStyle="bold"
        android:text="hello world jheds sdjhs jds sjbs skjs ksjs kksjs ksj sdd dskd js sk "/>

    <ImageView
        android:id="@+id/imge"
        android:layout_width="match_parent"
        android:layout_height="250dp"
        android:src="@drawable/imag_bg"/>


    <TextView
        android:id="@+id/texttwo"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:text="Pretty good, the Toolbar is moving along with the list and getting back just as we expect it to. This is thanks to the restrictions that we put …
Run Code Online (Sandbox Code Playgroud)

android android-support-library android-toolbar android-support-design

24
推荐指数
1
解决办法
5万
查看次数

单击主要活动中的后退按钮后,它将返回登录,如何停止重新登录

我对 Android 很陌生,我的登录活动工作正常,但我的问题是在成功登录我的应用程序后进入主要活动,进入我的主要活动后,当我按后退按钮时,它将再次转到登录页面,请任何人帮我解决这个问题

登录类

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_login);


    sharedpreferences = getSharedPreferences(mypreference, Context.MODE_PRIVATE);


    String checkemail=sharedpreferences.getString("Email", "");
    String checkuid =sharedpreferences.getString("Uid", "");

    if (checkemail.length()>0 && checkuid.length()>0){
        Intent main = new Intent(getApplicationContext(),MainActivity.class);
        startActivity(main);
    }


    username       =(EditText)findViewById(R.id.input_email);

    password       =(EditText)findViewById(R.id.input_password);

    login          =(Button)findViewById(R.id.btn_login);

    login.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            checkvalid();
        }
    });

    signup_link=(TextView)findViewById(R.id.link_signup);
    signup_link.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent signup= new Intent(getApplicationContext(),SignUp.class);
            startActivity(signup);
        }
    });

}
private void checkvalid()
{
    uname   =username.getText().toString();
    upassword=password.getText().toString();
    new AttemptLogin().execute();
    if …
Run Code Online (Sandbox Code Playgroud)

android

2
推荐指数
1
解决办法
2465
查看次数