Está en la página 1de 31

Angel Ricardo Spraud Ureña

2020-10621
Introducción al desarrollo de
apps móviles
Tarea intent
Realizar lo siguiente, una aplicación usando los intent que tenga varios layout y vistas
diferentes y que por un botón me permita entrar y que al entrar me pida el nombre de quien
ingresa y el género, en la otra ventana dos botones. uno para mostrarme una imagen de
superación para hombre nada más si eres hombre, si eres mujer solo superación para mujeres,
la imagen será seleccionada de una lista de mínimo 5 imágenes de forma aleatoria, y solo debe
mostrarse una al entrar en ese activity

otro botón para mostrarme una reflexión aleatoria, es decir cada vez que entre me muestre
una reflexión distinta también teniendo en cuenta si soy hombre o mujer.

• un botón para salir y volver a la ventana principal para volver a entrar.


• Antes de cerrar la app debe preguntarme si quiero cerrarla realmente
• en todas las ventanas debe haber un botón de salir de la app
• en todas las ventanas debe aparecer el nombre y el género de quien ingreso
• en la ventana de la reflexión en texto que me permita compartir el texto.
• En la reflexión de imágenes me permita compartir la imagen que se muestra

Código Fuente
import com.google.android.material.textfield.TextInputLayout;
public class MainActivity extends AppCompatActivity {
MaterialButton cerrar, siguiente;
TextInputLayout nombre;
RadioGroup radiobtn;
RadioButton Sexobtn;
private long atras;
Toast alert;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
cerrar = (MaterialButton) findViewById(R.id.btn_leave);
siguiente = (MaterialButton) findViewById(R.id.btn_verify);
nombre = (TextInputLayout) findViewById(R.id.tf_nombre);
radiobtn = (RadioGroup) findViewById(R.id.rg_gender);
siguiente.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
String getNombre =
nombre.getEditText().getText().toString().trim();
if(verifyText(getNombre)){
cerrarKeyboard();
int gender =
radiobtn.getCheckedRadioButtonId();
Sexobtn = findViewById(gender);
String gender_txt =
Sexobtn.getText().toString();
Bundle var =new Bundle();
Intent Iniciar = new
Intent(MainActivity.this,segunda.class);
var.putString("Usuario",getNombre);
var.putString("Sexo",gender_txt);
Iniciar.putExtras(var);
startActivity(Iniciar);
}
}
});
}
@Override
protected void onStart() {
super.onStart();
radiobtn.clearCheck();
radiobtn.check(R.id.rb_hombre);
}
private boolean verifyText(String _nombreVerif){
nombre.setErrorEnabled(true);
if(_nombreVerif.isEmpty()){
nombre.setError("tienes que insertar un nombre");
return false;
}else{
if(_nombreVerif.length() < 5){
nombre.setError("Tiene que ser mayor de 6 caracter");
return false;
}else if(_nombreVerif.length() > 18){
nombre.setError("no puede ser mayor a 18 caracteres");
return false;
}
nombre.setErrorEnabled(false);
return true;
}}
private void cerrarKeyboard(){
InputMethodManager keyboard =

(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
keyboard.hideSoftInputFromWindow(nombre.getWindowToken(),0);
}
@Override
public void onBackPressed() {
if(atras + 3000 > System.currentTimeMillis()){
super.onBackPressed();
if (Build.VERSION.SDK_INT >=
Build.VERSION_CODES.JELLY_BEAN) {
finishAffinity();
}
alert.cancel();
return;
}else{
alert = Toast.makeText(getApplicationContext(), "Debes
presionar el boton de salir", Toast.LENGTH_SHORT);
alert.show();
}
}
}
Segundo JAVA
package com.tarea5;
import androidx.appcompat.app.AppCompatActivity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.material.button.MaterialButton;
public class segunda extends AppCompatActivity {
MaterialButton atras, dejar;
TextView nombre, sexo;
private long atraspressdtime;
Toast alert;
TextView tv_nombre,tv_sexo;
Button btnImg, btnTexto;
private int imgsexo;
private int Textosexo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.segunda);
atras = (MaterialButton) findViewById(R.id.btn_atras);
dejar = (MaterialButton) findViewById(R.id.btn_dejar1);
tv_nombre = (TextView)
findViewById(R.id.tv_nombreSecond_activity);
tv_sexo = (TextView)
findViewById(R.id.tv_sexoSecond_activity);
btnImg = (Button) findViewById(R.id.btn_viewImage);
btnTexto = (Button) findViewById(R.id.btn_viewTexto);
Bundle var1=getIntent().getExtras();
tv_nombre.setText(var1.getString("Nombre"));
tv_sexo.setText(var1.getString("Sexo"));
btnImg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Bundle var = new Bundle();
Intent start = new
Intent(segunda.this,tercera.class);

var.putString("Nombre",tv_nombre.getText().toString().trim());

var.putString("Sexo",tv_sexo.getText().toString().trim());
var.putInt("Imagen",imgsexo);
start.putExtras(var);
startActivity(start);
}
});
btnTexto.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Bundle varTexto = new Bundle();
Intent start1 = new
Intent(segunda.this,cuarta.class);

varTexto.putString("nombre",tv_nombre.getText().toString().trim());

varTexto.putString("Sexo",tv_sexo.getText().toString().trim
());
varTexto.putInt("", Textosexo);
start1.putExtras(varTexto);
startActivity(start1);
}
});
atras.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent action = new
Intent(segunda.this,MainActivity.class);
startActivity(action);
}
});
dejar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Alert();
}
});
}
private void Alert(){
final AlertDialog.Builder builder = new
AlertDialog.Builder(segunda.this);
builder.setCancelable(false);
builder.setTitle("Adevertencia¡").setMessage("Quieres salir de
la aplicacion");
builder.setPositiveButton("Si", new
DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int
which) {
Intent close = new Intent(Intent.ACTION_MAIN);
close.addCategory(Intent.CATEGORY_HOME);
close.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(close);
finish();
}
}).setNegativeButton("No", new
DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int
which) {
dialog.dismiss();
}
});
builder.setIcon(R.drawable.close).create();
builder.show();
}
@Override
public void onAtrasPressed() {
if(atraspressdtime + 3000 > System.currentTimeMillis()){
super.onAtrasPressed();
if (Build.VERSION.SDK_INT >=
Build.VERSION_CODES.JELLY_BEAN) {
finishAffinity();
}
alert.cancel();
return;
}else{
alert = Toast.makeText(getApplicationContext(), "Debes
presionar el boton de salir", Toast.LENGTH_SHORT);
alert.show();
}
}
}
TERCER JAVA
package com.tarea5;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.StrictMode;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.material.button.MaterialButton;
import java.io.File;
import java.io.FileOutputStream;
public class tercera extends AppCompatActivity {
MaterialButton atras, dejar, compartir;
TextView nombre, genero;
ImageView img_genero;
private int img;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tercera);
atras = (MaterialButton) findViewById(R.id.btn_atras3);
dejar = (MaterialButton) findViewById(R.id.btn_dejar3);
compartir = (MaterialButton) findViewById(R.id.btn_compartir);
nombre = (TextView)
findViewById(R.id.tv_nombreThree_activity);
genero = (TextView)
findViewById(R.id.tv_generoThree_activity);
img_genero = (ImageView) findViewById(R.id.imgView_Hombre);
Bundle var1=getIntent().getExtras();
nombre.setText(var1.getString("nombreUser"));
genero.setText(var1.getString("generoUser"));
img = var1.getInt("ImagenUser");
img_genero.setImageResource(img);
compartir.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
compartirdImage();
}
});
dejar.setOnClickListener(new View.OnClickListener() {@Override
public void onClick(View v) {
Alert();
}
});
atras.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onAtrasPressed();
}
});
}
private void Alert(){
final AlertDialog.Builder builder = new
AlertDialog.Builder(tercera.this);
builder.setCancelable(false);
builder.setTitle("Advertencia!").setMessage("Quieres cerrar la
APP");
builder.setPositiveButton("SI!", new
DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int
which) {
Intent close = new Intent(Intent.ACTION_MAIN);
close.addCategory(Intent.CATEGORY_HOME);
close.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(close);
finish();
}
}).setNegativeButton("No", new
DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int
which) {
dialog.dismiss();
}
});
builder.setIcon(R.drawable.close).create();
builder.show();
}
@Override
public void onAtrasPressed() {
super.onAtrasPressed();
}
private void compartirdImage (){
StrictMode.VmPolicy.Builder builder = new
StrictMode.VmPolicy.Builder();
StrictMode.setVmPolicy(builder.build());
BitmapDrawable drawable =
(BitmapDrawable)img_genero.getDrawable();
Bitmap bitmap = drawable.getBitmap();
File f = new

File(getExternalCacheDir()+"/"+getResources().getString(R.string.app_n
ombre)
+".jpg");
Intent compartirdIntent;
try{
FileOutputStream outputStream = new FileOutputStream(f);
bitmap.compress(Bitmap.CompressFormat.PNG, 100,
outputStream);
outputStream.flush();
outputStream.close();
compartirdIntent =new Intent(Intent.ACTION_SEND);
compartirdIntent.setType("image/*");
compartirdIntent.putExtra(Intent.EXTRA_STREAM,
Uri.fromFile(f));

compartirdIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);}catch
(Exception
e){
throw new RuntimeException(e);
}
startActivity(Intent.createChooser(compartirdIntent,"Compartir
imagen"));
}
}
Cuarto JAVA
package com..tarea5;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.material.button.MaterialButton;
public class cuarta extends AppCompatActivity {
MaterialButton atras, dejar, compartir;
TextView nombre, sexo;
TextView tv_sexo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.cuarta);
atras = (MaterialButton) findViewById(R.id.btn_atras4);
dejar = (MaterialButton) findViewById(R.id.btn_dejar4);
compartir = (MaterialButton)
findViewById(R.id.btn_compartir1);
nombre = (TextView) findViewById(R.id.tv_nombrefour_activity);
sexo = (TextView) findViewById(R.id.tv_sexofour_activity);
tv_sexo = (TextView) findViewById(R.id.tv_phraseSexo);
Bundle var1 = getIntent().getExtras();
nombre.setText(var1.getString("nombre"));
sexo.setText(var1.getString("sexo"));
final String phrase =
getResources().getString(var1.getInt(""));
tv_sexo.setText(phrase);
compartir.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, phrase);
sendIntent.setType("text/plain");
Intent compartirIntent =
Intent.createChooser(sendIntent,
null);
if (sendIntent.resolveActivity(getPackageManager()) !=
null) {
startActivity(compartirIntent);
}
}
});
dejar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Alert();
}
});
atras.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onAtrasPressed();
}
});
}
private void Alert() {
final AlertDialog.Builder builder = new
AlertDialog.Builder(cuarta.this);
builder.setCancelable(false);
builder.setTitle("Advertencia¡"setMessage("Quieres cerrar la
app");
builder.setPositiveButton("Si!", new
DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int
which) {
Intent close = new Intent(Intent.ACTION_MAIN);
close.addCategory(Intent.CATEGORY_HOME);
close.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(close);
finish();
}
}).setNegativeButton("No", new
DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int
which) {
dialog.dismiss();
}
});
builder.setIcon(R.drawable.close).create();
builder.show();
}
@Override
public void onAtrasPressed() {
super.onAtrasPressed();
}
}
Código XML
Main Activity XML
<ScrollView 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">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/topbar"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentLeft="true">
<RelativeLayout
android:layout_width="294dp"
android:layout_height="match_parent">
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_leave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginStart="6dp"
android:layout_marginLeft="6dp"
android:backgroundTint="#F0DF3131"
android:text="Salir"
app:fontFamily="casual"
app:rippleColor="#7A3C3C"
app:strokeColor="#000000"
app:strokeWidth="2dp" />
</RelativeLayout>
</com.google.android.material.appbar.AppBarLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tf_name"

style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.De
nse"
android:layout_width="310dp"
android:layout_height="71dp"
android:layout_below="@id/topbar"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginHorizontal="30dp"
android:layout_marginStart="66dp"
android:layout_marginLeft="66dp"
android:layout_marginTop="28dp"
android:layout_marginEnd="100dp"
android:layout_marginRight="100dp"
android:gravity="center"
android:hint="Ingrese Su Nombre"
android:scrollIndicators="bottom"
android:textColorHint="#F80404"
app:counterEnabled="true"
app:counterMaxLength="18"
app:counterTextColor="#FFFFFF"
app:errorEnabled="true"
app:helperTextTextColor="#FFFFFF"
app:placeholderTextColor="#F1E5E5"
app:prefixTextColor="#FFFFFF"
app:startIconDrawable="@drawable/user"
app:suffixTextColor="#FFFFFF">
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_verify"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="6dp"
android:layout_marginRight="6dp"
android:layout_marginBottom="0dp"
android:backgroundTint="#FFFFFF"
android:elevation="1dp"
android:gravity="center"
android:text="Siguiente"
android:textColor="#000000"
app:fontFamily="casual"
app:rippleColor="#1CAE13"
app:strokeColor="#000000"
app:strokeWidth="2dp" />
</com.google.android.material.textfield.TextInputLayout>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tf_name"
android:layout_marginTop="50dp"
android:orientation="vertical"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentLeft="true">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-condensed-medium"
android:gravity="center"
android:text="Genero"
android:textSize="30dp"
android:textStyle="bold"
app:fontFamily="casual" />/>
<RadioGroup
android:id="@+id/rg_gender"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="15dp"
android:layout_weight="2"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:scrollbars="horizontal">
<RadioButton
android:id="@+id/rb_male"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:button="@null"
android:gravity="center"
android:text="Masculino"
android:textColor="#38FF00"
android:textSize="30dp"
app:fontFamily="casual" />
<RadioButton
android:id="@+id/rb_female"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:button="@null"
android:gravity="center"
android:text="Femenino"
android:textColor="#FF0000"
android:textSize="30dp"
app:fontFamily="casual" />
</RadioGroup>
</androidx.appcompat.widget.LinearLayoutCompat>
<com.google.android.material.textfield.TextInputEditText
android:layout_width="190dp"
android:layout_height="wrap_content"
android:inputType="text"
android:textColor="#000000"
android:textColorLink="#1A1DEA"
android:textSize="25dp"
android:typeface="sans"
app:fontFamily="casual" />
</RelativeLayout>
</ScrollView>
Segundo XML
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat
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"
android:id="@+id/fd_secondActivity"
android:orientation="vertical"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="2dp"
android:padding="5dp"
>
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginStart="130dp"
android:layout_marginLeft="130dp"
android:backgroundTint="#4069FF"
android:elevation="2dp"
android:text="Regresar"
android:textSize="18dp"
app:cornerRadius="10dp"
app:fontFamily="casual"
app:rippleColor="#FFAB40"
app:strokeColor="#ED000000"
app:strokeWidth="2dp" />
</RelativeLayout>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="60dp"
android:weightSum="2"
android:layout_marginTop="-20dp"
>
<TextView
android:id="@+id/tv_nameSecond_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="2dp"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:fontFamily="sans-serif-condensed-medium"
android:gravity="center|bottom"
android:padding="4dp"
android:textAlignment="center"
android:textColor="#212"
android:textSize="22dp"
app:fontFamily="casual" />
<TextView
android:id="@+id/tv_genderSecond_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:fontFamily="sans-serif-condensed-medium"
android:gravity="center|bottom"
android:padding="4dp"
android:text="Hombre"
android:textColor="#4CAF50"
android:textSize="22dp"
app:fontFamily="casual" />
</androidx.appcompat.widget.LinearLayoutCompat>
<Button
android:id="@+id/btn_viewImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="30dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:backgroundTint="#AF4C4C"
android:elevation="2dp"
android:gravity="center"
android:paddingHorizontal="4dp"
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="40dp"
android:textStyle="bold"
app:cornerRadius="12dp"
app:fontFamily="casual"
app:rippleColor="#FFDF40" />
<Button
android:id="@+id/btn_viewPhrase"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="30dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:backgroundTint="#FF5722"
android:elevation="2dp"
android:gravity="center"
android:paddingHorizontal="4dp"
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="40dp"
android:textStyle="bold"
app:cornerRadius="12dp"
app:fontFamily="casual"
app:rippleColor="#59FFEC" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_leave1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:layout_marginRight="20dp"
android:backgroundTint="#F40202"
android:elevation="2dp"
android:text="Salir"
android:textSize="18dp"
app:cornerRadius="10dp"
app:fontFamily="casual"
app:strokeColor="#000000"
app:strokeWidth="2dp" />
</androidx.appcompat.widget.LinearLayoutCompat>
TERCER XML
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat
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:orientation="vertical"
android:layout_height="match_parent"
tools:context=".tercera">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="2dp"
android:padding="5dp"
>
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_back3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginStart="120dp"
android:layout_marginLeft="120dp"
android:backgroundTint="#FF40EC"
android:elevation="2dp"
android:text="Regresar"
android:textSize="18dp"
app:cornerRadius="10dp"
app:fontFamily="casual"
app:rippleColor="#FFAB40"
app:strokeColor="#ED000000"
app:strokeWidth="2dp" />
</RelativeLayout>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="60dp"
android:weightSum="2"
android:layout_marginTop="-20dp"
>
<TextView
android:id="@+id/tv_nameThree_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="2dp"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:fontFamily="sans-serif-condensed-medium"
android:gravity="center|bottom"
android:padding="4dp"
android:textAlignment="center"
android:textColor="#212"
android:textSize="22dp"
app:fontFamily="casual" />
<TextView
android:id="@+id/tv_genderThree_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Hombre"
android:padding="4dp"
android:textSize="22dp"
app:fontFamily="casual"
android:fontFamily="sans-serif-condensed-medium"
android:textColor="#003CFF"
android:layout_weight="1"
android:gravity="center|bottom"
/>
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.cardview.widget.CardView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_gravity="center"
android:layout_marginHorizontal="16dp"
app:cardCornerRadius="8dp"
android:layout_marginTop="40dp"
app:cardElevation="8dp">
<ImageView
android:id="@+id/imgView_male"
android:layout_width="match_parent"
android:layout_height="179dp"
android:layout_margin="5dp"
android:scaleType="fitXY" />
</androidx.cardview.widget.CardView>
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_share"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginTop="20dp"
android:layout_marginHorizontal="70dp"
android:backgroundTint="#FFAB40"
app:cornerRadius="23dp"
app:rippleColor="#D500F9"
android:text="Compartir"
app:fontFamily="casual"
android:textSize="26dp"
android:pointerIcon="cell"
app:icon="@drawable/share"
app:iconTint="#00329C"
app:iconGravity="textStart"
android:elevation="2dp"
/>
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_leave3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="162dp"
android:layout_marginRight="162dp"
android:backgroundTint="#F40202"
android:elevation="2dp"
android:text="Salir"
android:textSize="18dp"
app:cornerRadius="10dp"
app:fontFamily="casual"
app:strokeColor="#000000"
app:strokeWidth="2dp" />
</androidx.appcompat.widget.LinearLayoutCompat>
Cuarto XML
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat
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"
android:orientation="vertical"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="2dp"
android:padding="5dp"
>
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_back4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginStart="128dp"
android:layout_marginLeft="128dp"
android:backgroundTint="#FFD740"
android:elevation="2dp"
android:text="Regresar"
android:textSize="18dp"
app:cornerRadius="10dp"
app:fontFamily="casual"
app:rippleColor="#FFAB40"
app:strokeColor="#ED000000"
app:strokeWidth="2dp" />
</RelativeLayout>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="60dp"
android:weightSum="2"
android:layout_marginTop="-20dp"
>
<TextView
android:id="@+id/tv_namefour_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="2dp"
android:layout_marginLeft="2dp"
android:layout_weight="1"
android:fontFamily="sans-serif-condensed-medium"
android:gravity="center|bottom"
android:padding="4dp"
android:textAlignment="center"
android:textColor="#212"
android:textSize="22dp"
app:fontFamily="casual" />
<TextView
android:id="@+id/tv_genderfour_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Hombre"
android:padding="4dp"
app:fontFamily="casual"
android:textSize="22dp"
android:fontFamily="sans-serif-condensed-medium"
android:textColor="#003CFF"
android:layout_weight="1"
android:gravity="center|bottom"
/>
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.cardview.widget.CardView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_gravity="center"
android:layout_marginHorizontal="16dp"
app:cardCornerRadius="8dp"
android:layout_marginTop="40dp"
android:backgroundTint="#2123"
app:cardElevation="15dp">
<TextView
android:id="@+id/tv_phraseGender"
android:layout_width="match_parent"
android:layout_height="370dp"
android:layout_margin="5dp"
android:textAlignment="center"
android:textSize="28dp"
android:gravity="center"
android:fontFamily="sans-serif-condensed"
android:textColor="#FFFFFF"
/>
</androidx.cardview.widget.CardView>
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_share1"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginTop="20dp"
android:layout_marginHorizontal="70dp"
android:backgroundTint="#FFAB40"
app:cornerRadius="23dp"
app:rippleColor="#D500F9"
android:text="Compartir"
app:fontFamily="casual"
android:textSize="26dp"
android:pointerIcon="cell"
app:icon="@drawable/share"
app:iconTint="#00329C"
app:iconGravity="textStart"
android:elevation="2dp"
/>
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_leave4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:backgroundTint="#F40202"
android:elevation="2dp"
android:text="Salir"
android:textSize="18dp"
app:cornerRadius="10dp"
app:fontFamily="casual"
app:strokeColor="#000000"
app:strokeWidth="2dp" />
</androidx.appcompat.widget.LinearLayoutCompat>

También podría gustarte