Quiero añadir dos ImageView
a mi layout
. En la Preview de Android Studio se muestran correctamente las imágenes con la API 22
pero al emular la aplicación en mi móvil de API 22 las imágenes no se ven. Utilizo la ultima versión de Android Studio y no encuentro el motivo de porque no se muestran correctamente las imágenes.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:weightSum="1"
android:id="@+id/cont">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="beforeDescendants"
android:focusable="true"
android:focusableInTouchMode="true"
android:id="@+id/scroll">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:descendantFocusability="beforeDescendants"
android:focusable="true"
android:focusableInTouchMode="true"
android:id="@+id/total">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="288dp"
android:descendantFocusability="beforeDescendants"
android:focusable="true"
android:focusableInTouchMode="true"
android:id="@+id/form">
<android.support.design.widget.TextInputLayout
android:layout_height="wrap_content"
android:layout_width="200dp"
android:layout_marginTop="90dp"
app:hintTextAppearance="@style/TextLabel"
android:layout_marginLeft="100dp"
android:scrollbarSize="20dp"
android:id="@+id/usu"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true">
<EditText
android:layout_height="match_parent"
android:hint="Correo"
android:inputType="textEmailAddress"
android:layout_width="200dp"
android:id="@+id/correo" />
</android.support.design.widget.TextInputLayout>
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:theme="?attr/actionBarTheme"
android:minHeight="?attr/actionBarSize"
android:id="@+id/toolbar"
android:layout_weight="0.13" />
<android.support.design.widget.TextInputLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:hintTextAppearance="@style/TextLabel"
android:id="@+id/co"
android:layout_marginTop="25dp"
android:layout_below="@+id/usu"
android:layout_alignLeft="@+id/usu"
android:layout_alignStart="@+id/usu">
<EditText
android:layout_width="200dp"
android:layout_height="match_parent"
android:hint="Contraseña"
android:layout_above="@+id/textInputLayout"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_weight="1"
android:id="@+id/pass" />
</android.support.design.widget.TextInputLayout>
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
app:srcCompat="@drawable/key"
android:id="@+id/imageView3"
android:layout_alignBottom="@+id/co"
android:layout_alignLeft="@+id/imageView2"
android:layout_alignStart="@+id/imageView2"
android:layout_marginBottom="8dp" />
<ImageView
android:layout_height="50dp"
app:srcCompat="@drawable/user"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:id="@+id/imageView2"
android:layout_above="@+id/co"
android:layout_toLeftOf="@+id/co"
android:layout_toStartOf="@+id/co"
android:layout_marginBottom="8dp"
android:layout_width="50dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="248dp">
<Button
android:text="Entrar"
android:layout_width="150dp"
android:layout_height="50dp"
android:drawableLeft="@drawable/login"
android:textColor="@android:color/white"
android:backgroundTint="#CDDC39"
android:id="@+id/entrar"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="26dp" />
<TextView
android:text="Aun no eres usuario?"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView"
android:textSize="20sp"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
<Button
android:text="Registrate"
android:layout_height="50dp"
android:drawableLeft="@drawable/account"
android:id="@+id/registro"
android:textColor="@android:color/white"
android:backgroundTint="#CDDC39"
android:layout_weight="0.13"
android:layout_width="150dp"
android:layout_below="@+id/textView"
android:layout_alignLeft="@+id/entrar"
android:layout_alignStart="@+id/entrar"
android:layout_marginTop="30dp" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#CDDC39</item>
<item name="colorPrimaryDark">#AFB42B</item>
<item name="colorAccent">#FFC107</item>
</style>
<style name="AppTheme" parent="AppTheme.Base"></style>
<style name="AppTheme.Base2" parent="Theme.AppCompat.Light">
<item name="colorPrimary">#CDDC39</item>
<item name="colorPrimaryDark">#AFB42B</item>
<item name="colorAccent">#518B05</item>
</style>
<style name="AppTheme2" parent="AppTheme.Base"></style>
<style name="TextLabel" parent="TextAppearance.Design.Hint">
<item name="android:textSize">20sp</item>
</style>
</resources>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:hardwareAccelerated="false"
android:supportsRtl="true"
android:theme="@style/AppTheme"
>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Sesion.Registro"
android:parentActivityName=".Sesion.Login">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".Sesion.Login" />
</activity>
<activity android:name=".Sesion.Login"
android:windowSoftInputMode="stateUnspecified">
</activity>
</application>
Login.java
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.libreria.conxi.proyecto.R;
import static android.content.ContentValues.TAG;
public class Login extends Activity {
private FirebaseAuth mAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
mAuth = FirebaseAuth.getInstance();
//Boton para dirigir a la Activity de Registro
Button btn2 = (Button) findViewById(R.id.registro);
btn2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent2 = new Intent (v.getContext(), Registro.class);
startActivityForResult(intent2, 0);
}
});
//Boton para entrar en el usuario
Button btn = (Button) findViewById(R.id.entrar);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
EditText correo = (EditText) findViewById(R.id.correo);
EditText pass = (EditText) findViewById(R.id.pass);
String email=correo.getText().toString();
String password=pass.getText().toString();
if (email.equals("")) {
Toast.makeText(getApplicationContext(), "Enter email address!", Toast.LENGTH_SHORT).show();
return;
}
if (password.equals("")) {
Toast.makeText(getApplicationContext(), "Enter password!", Toast.LENGTH_SHORT).show();
return;
}
mAuth.signInWithEmailAndPassword(email, password)
.addOnCompleteListener(Login.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (!task.isSuccessful()) {
// there was an error
Log.w(TAG, "signInWithEmail", task.getException());
Toast.makeText(Login.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
} else {
Log.w(TAG, "signInWithEmail", task.getException());
Toast.makeText(Login.this, "Authentication success.",
Toast.LENGTH_SHORT).show();
}
}
});
}
});
}
}
¿ Alguna idea para solucionar este problema ?