Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/399.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 为什么赢了';我的xml中的textinputlayout没有显示吗?_Java_Android_Xml_Layout_Android Textinputlayout - Fatal编程技术网

Java 为什么赢了';我的xml中的textinputlayout没有显示吗?

Java 为什么赢了';我的xml中的textinputlayout没有显示吗?,java,android,xml,layout,android-textinputlayout,Java,Android,Xml,Layout,Android Textinputlayout,我创建的textinputlayout用于登录屏幕,但每当启动活动时,除此之外的所有内容都会显示出来。点击它应该在的空间也不会做任何事情(键盘不会弹出),因此它的可见性似乎已经设置为“消失”,即使它没有 布局文件: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://s

我创建的textinputlayout用于登录屏幕,但每当启动活动时,除此之外的所有内容都会显示出来。点击它应该在的空间也不会做任何事情(键盘不会弹出),因此它的可见性似乎已经设置为“消失”,即使它没有

布局文件:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:id="@+id/rootView"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="org.thelatinschool.canvasgrades.SplashScreenActivity">

<ImageView
    android:id="@+id/logo"
    android:layout_width="75dp"
    android:layout_height="75dp"
    android:layout_centerInParent="true"
    android:contentDescription="@null"
    android:src="@mipmap/ic_launcher_round"
    android:visibility="visible" />

<ProgressBar
    android:id="@+id/loadingProgressBar"
    style="?android:attr/progressBarStyleHorizontal"
    android:layout_width="match_parent"
    android:layout_height="12dp"
    android:layout_alignParentBottom="true"
    android:layout_marginBottom="-4dp"
    android:foregroundGravity="bottom"
    android:indeterminate="true"
    android:padding="0dp"
    android:theme="@style/ProgressBarStyle"
    android:visibility="visible" />

<RelativeLayout
    android:id="@+id/afterAnimationView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginStart="20dp"
    android:layout_marginTop="130dp"
    android:layout_marginEnd="20dp"
    android:orientation="vertical"
    android:visibility="visible">

    <TextView
        android:id="@+id/WelcomeTextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Highlands Latin School"
        android:textColor="@color/colorPrimary"
        android:textSize="25sp"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/readItTogetherTextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/WelcomeTextView"
        android:layout_marginTop="10dp"
        android:text="Canvas Grades"
        android:textColor="@color/colorAccent"
        android:textSize="15sp" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/loginButton"
        android:layout_below="@+id/readItTogetherTextView"
        android:gravity="center"
        android:orientation="vertical">

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/emailEditText"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:hint="Email"
            android:textColor="@color/colorPrimary"
            android:textColorHint="@color/colorAccent"
            android:textSize="15sp"
            app:boxBackgroundMode="outline" />

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/passwordEditText"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:layout_marginTop="25dp"
            android:hint="Password"
            android:textColor="@color/colorPrimary"
            android:textColorHint="@color/colorAccent"
            android:textSize="15sp"
            app:boxStrokeColor="#000000" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:padding="5dp">

            <Button
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="end|center_vertical"
                android:background="#FFFFFF"
                android:text="Forgot Password?"
                android:textColor="@color/colorAccent"
                android:textSize="14sp"
                android:textStyle="bold" />
        </FrameLayout>
    </LinearLayout>

    <Button
        android:id="@+id/loginButton"
        android:layout_width="match_parent"
        android:layout_height="55dp"
        android:layout_above="@+id/skipTextView"
        android:layout_marginBottom="5dp"
        android:background="@drawable/button_drawable"
        android:text="Login"
        android:textAllCaps="false"
        android:textColor="#FFFFFF"
        android:textSize="16sp" />

    <TextView
        android:id="@+id/skipTextView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_marginBottom="10dp"
        android:background="?android:attr/selectableItemBackground"
        android:clickable="true"
        android:focusable="true"
        android:gravity="center"
        android:padding="12dp"
        android:text="Incorrect username or password!"
        android:textColor="#B53737"
        android:textSize="15sp"
        android:visibility="invisible" />

</RelativeLayout>
</RelativeLayout>

以及相应的java:

public class SplashScreenActivity extends AppCompatActivity {
public String theme1;
private ProgressDialog progressDialog;
private boolean animationStarted = false;
private ImageView bookIconImageView;
private TextView bookITextView;
private ProgressBar loadingProgressBar;
int progress;
private RelativeLayout rootView, afterAnimationView;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash_activity);
    bookIconImageView = findViewById(R.id.logo);
    loadingProgressBar = (ProgressBar)findViewById(R.id.loadingProgressBar);
    rootView = findViewById(R.id.rootView);
    afterAnimationView = findViewById(R.id.afterAnimationView);
    Thread thred = new Thread(new Runnable() {
        @Override
        public void run() {
            doWork();
            startApp();
        }
        public void doWork() {
            for (progress=10;progress<100;progress=progress+10){
                try {
                    Thread.sleep(350);
                    loadingProgressBar.setProgress(progress);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }} }
        public void startApp(){
            runOnUiThread(new Runnable() {
                              @Override
                              public void run() {
                                  loadingProgressBar.setVisibility(GONE);
                                  rootView.setBackgroundColor(ContextCompat.getColor(SplashScreenActivity.this, R.color.splashscreen));
                                  bookIconImageView.setImageResource(R.mipmap.ic_launcher_round);
                              }
                          });
            startAnimation();
        };
});
    thred.start();
}


private void startAnimation() {
    ViewPropertyAnimator viewPropertyAnimator = bookIconImageView.animate();
    viewPropertyAnimator.x(50f);
    viewPropertyAnimator.y(100f);
    viewPropertyAnimator.setDuration(1000);
    viewPropertyAnimator.setListener(new Animator.AnimatorListener() {
        @Override
        public void onAnimationStart(Animator animation) {

        }

        @Override
        public void onAnimationEnd(Animator animation) {
            afterAnimationView.setVisibility(VISIBLE);
        }

        @Override
        public void onAnimationCancel(Animator animation) {

        }

        @Override
        public void onAnimationRepeat(Animator animation) {

        }
    });
}
// Intent myIntent = new Intent(SplashScreenActivity.this, MainActivity.class);
//        SplashScreenActivity.this.startActivity(myIntent);
}
公共类SplashScreenActivity扩展了AppCompatActivity{
公共字符串主题1;
私有进程对话;
私有布尔animationStarted=false;
私有图像视图bookIconImageView;
私有文本视图bookITextView;
私有ProgressBar加载ProgressBar;
智力进步;
private RelativeLayout根视图,afterAnimationView;
@凌驾
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.splash_活动);
bookIconImageView=findViewById(R.id.logo);
loadingProgressBar=(ProgressBar)findViewById(R.id.loadingProgressBar);
rootView=findviewbyd(R.id.rootView);
afterAnimationView=findViewById(R.id.afterAnimationView);
Thread thred=新线程(new Runnable(){
@凌驾
公开募捐{
销钉();
startApp();
}
公共工作{

对于(progress=10;progress,您很可能错过了添加应用程序级材料设计依赖项

// material Design support library - androidx
implementation 'com.google.android.material:material:1.0.0'


// material Design support library - support library
implementation 'com.android.support:design:28.0.0'
更新

您缺少在
TextInputLayout
中添加
textinputText
,因此您不会期望看到什么,也可以将
android:hint
android:textSize
android:textColorHint
属性移动到
textinputText
中,而不是
TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
    android:id="@+id/emailEditText"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    app:boxBackgroundMode="outline">

    <com.google.android.material.textfield.TextInputEditText
        android:id="@+id/et_email"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Email"
        android:inputType="textEmailAddress"
        android:textColor="@color/colorPrimary"
        android:textColorHint="@color/colorAccent"
        android:textSize="15sp" />

</com.google.android.material.textfield.TextInputLayout>


我已经有了androidx支持库,但我仍然有与之相同的IssueEYP,我不需要TextInputLayout,只是EditText字段TextInputLayout也很有用,它会在TextInputText上方显示一点文本,当他们在TextInputText中键入文本时,用户体验会更好当用户键入其名称时,他提示“name”,您不能将材质组件库和支持一起使用design@GabrieleMariotti你说得对,把这两个都放进去,因为问题不知道用的是哪一个。谢谢