我有一项活动,当我点击"注册" TextView片段将打开,在该片段中,所有注册详细信息都在那里。但是当我点击文本视图时,片段已成功加载但它确实掩盖了整个屏幕。
这是我的代码:
MainActivity.java
Register.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
android.support.v4.app.FragmentManager fragmentManager=getSupportFragmentManager();
android.support.v4.app.FragmentTransaction fragmentTransaction=fragmentManager.beginTransaction();
Fragments fragments=new Fragments();
fragmentTransaction.replace(R.id.Fragment_Register,fragments);
fragmentTransaction.commit();
fragmentTransaction.addToBackStack(null);
}
});
}
MainActivity.xml
<?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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.user.attendance.MainActivity"
android:background="@drawable/blurbackgound"
android:padding="10dp"
android:focusableInTouchMode="true"
>
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20dp"
android:text="WELCOME"
android:textColor="@color/white"
android:textStyle="bold"
android:fontFamily="monospace"
android:layout_centerHorizontal="true"
android:layout_marginTop="100dp"/>
<EditText
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_below="@id/title"
android:id="@+id/login_mobile_number"
android:layout_centerHorizontal="true"
android:layout_marginTop="65dp"
android:background="@drawable/edit_text_border"
android:padding="15dp"
android:textColor="@color/white"
android:inputType="number"
android:hint="Enter mobile number"
android:gravity="center"
android:maxLength="10"
android:textColorHint="@color/hint_color"
/>
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/ic_local_phone_black_24dp"
android:layout_below="@id/title"
android:layout_marginLeft="30dp"
android:layout_marginTop="73dp"
android:id="@+id/phonelogo"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/mb_counter"
android:layout_below="@id/title"
android:layout_marginLeft="300dp"
android:layout_alignBaseline="@id/login_mobile_number"
android:text="abssh"
android:textColor="@color/white"
/>
<EditText
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@id/login_mobile_number"
android:layout_marginTop="25dp"
android:background="@drawable/edit_text_border"
android:paddingRight="50dp"
android:hint="Password"
android:gravity="center"
android:textColorHint="@color/hint_color"
android:inputType="textPassword"
android:textColor="@color/white"
android:id="@+id/login_password"
/>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:layout_margin="1dp"
android:layout_below="@id/login_password"
android:orientation="horizontal"
>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:buttonTint="@color/white"
android:text="Student"
android:textColor="@color/white"
android:id="@+id/Radio_button_student"
android:layout_marginLeft="19dp"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:buttonTint="@color/white"
android:text="Teacher"
android:textColor="@color/white"
android:id="@+id/Radio_button_teacher"/>
</RadioGroup>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SHOW"
android:textColor="@color/white"
android:textStyle="bold"
android:layout_alignRight="@id/login_password"
android:layout_alignBaseline="@id/login_password"
android:id="@+id/password_visibility"
android:layout_marginRight="10dp"
/>
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/ic_lock_outline_black_50dp"
android:layout_marginLeft="30dp"
android:layout_below="@id/phonelogo"
android:layout_marginTop="39dp"
/>
<Button
android:stateListAnimator="@null"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:hint="Login"
android:id="@+id/login"
android:background="@drawable/login_buttom"
android:textColorHint="@color/hint_color"
android:layout_below="@id/login_password"
android:layout_marginTop="50dp"
android:layout_marginLeft="35dp"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="FORGOT PASSWORD"
android:textColor="@color/white"
android:layout_below="@id/login"
android:layout_marginTop="18dp"
android:layout_marginLeft="48dp"
android:id="@+id/forgot_password"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="|"
android:textColor="@color/white"
android:layout_alignBaseline="@id/forgot_password"
android:layout_marginLeft="170dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="REGISTER"
android:textColor="@color/white"
android:layout_below="@id/login"
android:layout_marginLeft="185dp"
android:layout_marginTop="20dp"
android:id="@+id/Register"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/Fragment_Register"></RelativeLayout>
</RelativeLayout>
Fragments.java
package com.example.user.attendance;
import android.app.FragmentManager;
import android.text.Editable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import de.hdodenhof.circleimageview.CircleImageView;
public class Fragments extends Fragment {
Button Register_Cancel_fullname, Register_Cancel_email, Register_Cancel_phone,
Register_Cancel_password, Sign_up,Register_Cancel_Confirm_Password;
String Passcode,Confirm_Passcode;
EditText Full_Name, Email_Address, Phone_number, Password_register,Confirm_Password_register;
CircleImageView Register_add_photo;
LinearLayout select_photo_from_camera,select_photo_from_gallery;
TextView textView,hint_textview_circular_image_view;
// RadioButton Category_teacher,Category_student;
RadioGroup Teacher_student;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View myfragmentVieew = inflater.inflate(R.layout.fragment_signup, container, false);
//Edit Text
Full_Name = (EditText) myfragmentVieew.findViewById(R.id.Register_name_and_surname);
Email_Address = (EditText) myfragmentVieew.findViewById(R.id.Register_Email_address);
Phone_number = (EditText) myfragmentVieew.findViewById(R.id.Register_Phone);
Password_register = (EditText) myfragmentVieew.findViewById(R.id.Register_Password);
Confirm_Password_register=(EditText)myfragmentVieew.findViewById(R.id
.Confirm_Password_Register);
//Button
Sign_up = (Button) myfragmentVieew.findViewById(R.id.Register_Signup);
Register_Cancel_fullname = (Button) myfragmentVieew.findViewById(R.id.Register_First_Cancel_Button);
Register_Cancel_email = (Button) myfragmentVieew.findViewById(R.id.Register_Second_Cancel_Button);
Register_Cancel_phone = (Button) myfragmentVieew.findViewById(R.id.Register_Third_Cancel_Button);
Register_Cancel_password = (Button) myfragmentVieew.findViewById(R.id.Register_fourth_Cancel_Button);
Register_Cancel_Confirm_Password=(Button)myfragmentVieew.findViewById(R.id
.Register_Cancel_Confirm_Password_Button);
Register_add_photo=(CircleImageView)myfragmentVieew.findViewById(R.id.Register_add_photo);
//TextView
textView = (TextView) myfragmentVieew.findViewById(R.id.Register_textview);
hint_textview_circular_image_view=(TextView)myfragmentVieew.findViewById(R.id
.hint_of_image_view);
return myfragmentVieew;
}
}
以下是我的内容: encoded_array
答案 0 :(得分:0)
从根布局中删除此行。
android:padding="10dp"
这将解决问题。