我正在Android工作室登录应用程序 当我打开应用程序我不能在用户名和密码字段(edittext-登录活动)输入任何东西..它不显示有一个EditText上! 我下面UI安卓工作室错误
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".Login"
android:label="@string/title_activity_login"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SingUp"></activity>
</application>
我logcat的清单代码低于
03-15 07:42:08.206 2220-2220/com.example.dp_7_kholood.taskone I/art: Not late-enabling -Xcheck:jni (already on)
03-15 07:42:08.253 2220-2220/com.example.dp_7_kholood.taskone W/System: ClassLoader referenced unknown path: /data/app/com.example.dp_7_kholood.taskone-1/lib/x86
03-15 07:42:08.323 2220-2235/com.example.dp_7_kholood.taskone D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
03-15 07:42:08.460 2220-2235/com.example.dp_7_kholood.taskone I/OpenGLRenderer: Initialized EGL, version 1.4
03-15 07:42:08.491 2220-2235/com.example.dp_7_kholood.taskone W/EGL_emulation: eglSurfaceAttrib not implemented
03-15 07:42:08.492 2220-2235/com.example.dp_7_kholood.taskone W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xabfab2e0, error=EGL_SUCCESS
03-15 07:42:11.887 2220-2235/com.example.dp_7_kholood.taskone W/EGL_emulation: eglSurfaceAttrib not implemented
03-15 07:42:11.887 2220-2235/com.example.dp_7_kholood.taskone W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xabfabdc0, error=EGL_SUCCESS
03-15 07:42:11.967 2220-2235/com.example.dp_7_kholood.taskone W/EGL_emulation: eglSurfaceAttrib not implemented
03-15 07:42:11.967 2220-2235/com.example.dp_7_kholood.taskone W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xad809160, error=EGL_SUCCESS
03-15 07:42:12.053 2220-2235/com.example.dp_7_kholood.taskone E/Surface: getSlotFromBufferLocked: unknown buffer: 0xab850b20
03-15 07:42:13.847 2220-2235/com.example.dp_7_kholood.taskone E/Surface: getSlotFromBufferLocked: unknown buffer: 0xab850c70
03-15 07:42:15.311 2220-2235/com.example.dp_7_kholood.taskone W/EGL_emulation: eglSurfaceAttrib not implemented
03-15 07:42:15.311 2220-2235/com.example.dp_7_kholood.taskone W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xabfab400, error=EGL_SUCCESS
03-15 07:42:15.400 2220-2235/com.example.dp_7_kholood.taskone E/Surface: getSlotFromBufferLocked: unknown buffer: 0xab8525d0
a
我登录活动XML
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Username"
android:id="@+id/TVusername"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/Tfusername"
android:layout_below="@+id/TVusername"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Password"
android:id="@+id/textView2"
android:layout_below="@+id/Tfusername"
android:layout_alignRight="@+id/TVusername"
android:layout_alignEnd="@+id/TVusername"
android:layout_marginTop="24dp" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:ems="10"
android:id="@+id/Tfpassword"
android:layout_below="@+id/textView2"
android:layout_alignLeft="@+id/textView2"
android:layout_alignStart="@+id/textView2"
android:layout_alignRight="@+id/Tfusername"
android:layout_alignEnd="@+id/Tfusername" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login"
android:id="@+id/Blogin"
android:onClick="onButtonClick"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sign Up"
android:id="@+id/BtnSingup"
android:layout_below="@+id/Blogin"
android:layout_alignLeft="@+id/Blogin"
android:layout_alignStart="@+id/Blogin"
android:onClick="onButtonClick" />
我的Java代码像下面
public class Login extends AppCompatActivity {
DatabaseHelper helper=new DatabaseHelper(this);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
}
public void onButtonClick(View v){
if (v.getId() == R.id.Blogin);
{
EditText a = (EditText)findViewById(R.id.Tfusername);
String str= a.getText().toString();
EditText b = (EditText)findViewById(R.id.Tfpass);
String pass= b.getText().toString();
String password= helper.searchPass(str);
if(pass.equals(password)){
Intent i= new Intent(Login.this, SingUp.class);
i.putExtra("Username",str);
startActivity(i);
}
else{
Toast t=Toast.makeText(Login.this, "Username and Paasword not match!", Toast.LENGTH_SHORT);
t.show();
}}
if(v.getId()==R.id.BtnSingup){
Intent i= new Intent(Login.this, SingUp.class);
startActivity(i);
}
}
}
没有父视图?没有logcat? – Rainey
我发布logcat结果 – Khulood
为所有EditText视图提供背景颜色并查看它们是否正在显示。如果是的话,那么问题原因将是你的应用程序主题。检查主题。 –