Parcial 2

Portafolio Parcial 2:

Nota Importante, no subí screnshots por que mi computadora no corre el programa asi que no tenia manera de sacarlas.

Código 1:

<LinearLayout
    android:orientation="vertical"
    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.lap_c_pc35.Ejercicio_1.MainActivity">


    <Button
        android:id="@+id/button1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />

    <Button
        android:id="@+id/button2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />

    <Button
        android:id="@+id/button3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />

    <Button
        android:id="@+id/button4"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />

    <Button
        android:id="@+id/button6"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />

    <Button
        android:id="@+id/button5"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />

    <Button
        android:id="@+id/button7"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />

    <Button
        android:id="@+id/button8"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />

    <Button
        android:id="@+id/button9"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />

    <Button
        android:id="@+id/button10"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />

    <Button
        android:id="@+id/button11"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />

    <Button
        android:id="@+id/button12"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />

    <Button
        android:id="@+id/button13"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />

    <Button
        android:id="@+id/button14"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />

    <Button
        android:id="@+id/button15"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />

    <Button
        android:id="@+id/button16"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />

    <Button
        android:id="@+id/button17"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />

    <Button
        android:id="@+id/button18"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />

    <Button
        android:id="@+id/button19"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />

    <Button
        android:id="@+id/button20"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />

</LinearLayout>

Cosas que aprendí:

En este trabajo aprendi a como poder hacer que muchos botones que no caben en una pantalla puedan deslisarce para verlos todos.

Trabajo 2:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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.lb_c_pc32.miapicacin.MainActivity">

    <LinearLayout
        android:layout_width="368dp"
        android:layout_height="495dp"
        android:orientation="vertical"
        tools:layout_editor_absoluteY="8dp"
        tools:layout_editor_absoluteX="8dp">

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            app:layout_constraintDimensionRatio="w,1:1"
            tools:ignore="MissingConstraints"
            tools:layout_editor_absoluteX="0dp"
            tools:layout_editor_absoluteY="0dp">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <Button
                    android:id="@+id/button25"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Button" />

                <Button
                    android:id="@+id/button26"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Button" />

                <Button
                    android:id="@+id/button27"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Button" />

                <Button
                    android:id="@+id/button28"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Button" />

                <Button
                    android:id="@+id/button29"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Button" />

                <Button
                    android:id="@+id/button30"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Button" />

                <Button
                    android:id="@+id/button31"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Button" />

                <Button
                    android:id="@+id/button32"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Button" />

                <Button
                    android:id="@+id/button33"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Button" />

                <Button
                    android:id="@+id/button34"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Button" />

                <Button
                    android:id="@+id/button35"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Button" />

                <Button
                    android:id="@+id/button36"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Button" />

                <Button
                    android:id="@+id/button37"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Button" />

                <Button
                    android:id="@+id/button38"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Button" />

                <Button
                    android:id="@+id/button39"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Button" />

                <Button
                    android:id="@+id/button40"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Button" />

                <Button
                    android:id="@+id/button41"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Button" />

                <Button
                    android:id="@+id/button42"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Button" />

                <Button
                    android:id="@+id/button43"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Button" />

                <Button
                    android:id="@+id/button44"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Button" />
            </LinearLayout>

        </ScrollView>

        <HorizontalScrollView
            android:id="@+id/horizontalScrollView"
            android:layout_width="match_parent"
            android:layout_weight="1"
            android:layout_height="match_parent"
            tools:ignore="MissingConstraints"
            tools:layout_editor_absoluteX="0dp"
            tools:layout_editor_absoluteY="261dp">

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:orientation="horizontal">

                <Button
                    android:id="@+id/Button1"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:text="Button" />

                <Button
                    android:id="@+id/Button2"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:text="Button" />

                <Button
                    android:id="@+id/Button3"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:text="Button" />

                <Button
                    android:id="@+id/Button4"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:text="Button" />

                <Button
                    android:id="@+id/Button5"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:text="Button" />

                <Button
                    android:id="@+id/Button6"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:text="Button" />

                <Button
                    android:id="@+id/Button7"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:text="Button" />

                <Button
                    android:id="@+id/Button8"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:text="Button" />

                <Button
                    android:id="@+id/Button9"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:text="Button" />

                <Button
                    android:id="@+id/Button10"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:text="Button" />

                <Button
                    android:id="@+id/Button11"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:text="Button" />

                <Button
                    android:id="@+id/Button12"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:text="Button" />

                <Button
                    android:id="@+id/Button13"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:text="Button" />

                <Button
                    android:id="@+id/Button14"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:text="Button" />

                <Button
                    android:id="@+id/Button15"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:text="Button" />

                <Button
                    android:id="@+id/Button16"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:text="Button" />

                <Button
                    android:id="@+id/Button17"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:text="Button" />

                <Button
                    android:id="@+id/Button18"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:text="Button" />

                <Button
                    android:id="@+id/Button19"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:text="Button" />

                <Button
                    android:id="@+id/Button20"
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:text="Button" />
            </LinearLayout>

        </HorizontalScrollView>
    </LinearLayout>

</android.support.constraint.ConstraintLayout>

Cosas que aprendí:

En este trabajo aprendi a modificar el tipo de desplazamiento que se puede hacer, vertical y horizontal.

Trabajo 3:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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:background="#9999ff"
    tools:context="mx.edu.ittepic.ejercicio2.Practica_2">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Bienvenido!!"
        android:textSize="25sp"
        app:layout_constraintHorizontal_bias="0.881"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.11"
        app:layout_constraintLeft_toRightOf="@+id/imageView"
        android:layout_marginLeft="8dp"
        android:layout_marginBottom="8dp"
        app:layout_constraintBottom_toTopOf="@+id/textView2"
        android:id="@+id/textView8" />

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="150dp"
        android:layout_height="140dp"
        app:srcCompat="@drawable/logocetis"
        android:layout_marginRight="224dp"
        app:layout_constraintRight_toRightOf="@+id/textView8"
        android:layout_marginLeft="8dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        android:layout_marginTop="2dp" />

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="A la programacion"
        android:textSize="25sp"
        app:layout_constraintRight_toLeftOf="@+id/textView2"
        android:layout_marginRight="8dp"
        android:layout_marginLeft="8dp"
        app:layout_constraintLeft_toLeftOf="parent"
        android:layout_marginTop="8dp"
        app:layout_constraintTop_toBottomOf="@+id/imageView" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Con Android!!"
        android:textSize="25sp"
        android:layout_marginRight="9dp"
        app:layout_constraintRight_toRightOf="parent"
        android:layout_marginTop="8dp"
        app:layout_constraintTop_toBottomOf="@+id/imageView" />

    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Estudiante de Bachillerato"
        android:textSize="25sp"
        android:layout_marginRight="6dp"
        app:layout_constraintRight_toRightOf="parent"
        android:layout_marginTop="8dp"
        app:layout_constraintTop_toBottomOf="@+id/textView2"
        app:layout_constraintLeft_toLeftOf="parent"
        android:layout_marginLeft="8dp" />

    <TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Un mundo fantastico te espera!!!"
        android:textSize="25sp"
        app:layout_constraintLeft_toRightOf="parent"
        android:layout_marginLeft="-384dp"
        android:layout_marginRight="8dp"
        app:layout_constraintRight_toRightOf="parent"
        android:layout_marginBottom="8dp"
        app:layout_constraintBottom_toTopOf="@+id/textView5"
        android:layout_marginTop="8dp"
        app:layout_constraintTop_toBottomOf="@+id/textView3" />

    <TextView
        android:id="@+id/textView5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Con android"
        android:textSize="25sp"
        android:layout_marginRight="8dp"
        app:layout_constraintRight_toRightOf="parent"
        android:layout_marginLeft="8dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintBottom_toBottomOf="@+id/textView6"
        app:layout_constraintHorizontal_bias="0.502"
        android:layout_marginBottom="8dp" />

    <TextView
        android:id="@+id/textView6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Estas Preparado!?"
        android:textSize="25sp"
        android:layout_marginRight="8dp"
        app:layout_constraintRight_toRightOf="parent"
        android:layout_marginTop="16dp"
        app:layout_constraintTop_toBottomOf="@+id/textView5"
        android:layout_marginLeft="8dp"
        app:layout_constraintLeft_toLeftOf="parent" />

    <Button
        android:id="@+id/Off"
        android:layout_width="63dp"
        android:layout_height="33dp"
        android:text="Off"
        android:layout_marginRight="8dp"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintLeft_toRightOf="@+id/textView6"
        android:layout_marginLeft="8dp"
        android:layout_marginTop="52dp"
        app:layout_constraintTop_toBottomOf="@+id/textView6"
        app:layout_constraintHorizontal_bias="0.272" />

    <TextView
        android:id="@+id/textView7"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="56dp"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="7dp"
        android:text="No te arrepentiras! PDT no te creas"
        android:textSize="25sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent" />

    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Salir"
        android:layout_marginTop="65dp"
        app:layout_constraintTop_toBottomOf="@+id/Off"
        app:layout_constraintLeft_toRightOf="@+id/textView7"
        android:layout_marginLeft="-10dp" />

</android.support.constraint.ConstraintLayout>

Cosas que aprendí:

En esta actividad aprendimos a familiarizarnos con el “ConstraintLayout” y sus distintos tipos de uso.

Trabajo 5:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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.lap_c_pc46.ejercicio5.Parimpar">

    <TextView
        android:id="@+id/textView"
        android:layout_width="270dp"
        android:layout_height="38dp"
        android:text="Escribe un numero:"
        android:textSize="20sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintHorizontal_bias="0.14"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.002" />

    <EditText
        android:id="@+id/numero"
        android:layout_width="wrap_content"
        android:layout_height="63dp"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="8dp"
        android:ems="10"
        android:inputType="textPersonName"
        android:text="Numero:"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView" />

    <Button
        android:id="@+id/verificar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="64dp"
        android:text="Verificar"
        app:layout_constraintBottom_toTopOf="@+id/resultado"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/numero" />

    <TextView
        android:id="@+id/resultado"
        android:layout_width="208dp"
        android:layout_height="45dp"
        android:layout_marginBottom="8dp"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:text="Resultado:"
        android:textSize="20sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent" />

</android.support.constraint.ConstraintLayout>

Trabajo 5 Java:

package com.example.lap_c_pc46.ejercicio5;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

public class Parimpar extends AppCompatActivity {
    public EditText numero;
    public TextView resultado;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_parimpar);

        numero=(EditText)findViewById(R.id.numero);
        resultado=
                (TextView)findViewById(R.id.resultado);
    }
    public void verificar(View view) {
        int num;
        String respuesta;

        num= Integer.parseInt(numero,getText().toString());
        if (num%2==0)
            respuesta="Numero Par";
        else
            respuesta="Numero Impar";
    }
}

Cosas que aprendí:

En esta actividad aprendí a como usar el if.

Trabajo 6 java:

public class MainActivity extends AppCompatActivity {
public EditText numero1, numero2, resultado;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        numero1=(EditText)findViewById(R.id.editNUMERO1);
        numero2=(EditText)findViewById(R.id.editNUMERO2);
        resultado=(EditText)findViewById(R.id.editRES);
    }
    public void suma(View View ){
        float suma;

        float n1= Float.parseFloat(numero1.getText().toString());
        float n2= Float.parseFloat(numero2.getText().toString());
        suma= n1+n2;
        resultado.setText(String.valueOf(suma));
    }
    public void rest(View View ){
        float suma;

        float n1= Float.parseFloat(numero1.getText().toString());
        float n2= Float.parseFloat(numero2.getText().toString());
        suma= n1-n2;
        resultado.setText(String.valueOf(suma));
    }
    public void mult(View View ){
        float suma;

        float n1= Float.parseFloat(numero1.getText().toString());
        float n2= Float.parseFloat(numero2.getText().toString());
        suma= n1*n2;
        resultado.setText(String.valueOf(suma));
    }
    public void div(View View ){
        float suma;

        float n1= Float.parseFloat(numero1.getText().toString());
        float n2= Float.parseFloat(numero2.getText().toString());
        suma= n1/n2;
        resultado.setText(String.valueOf(suma));
    }

    public void borrar (View View){
        String rest= "respuesta";
        String rest2="";
        resultado.setText("");
        numero1.setText("");
        numero2.setText("");}

Cosas que aprendí:

En este aprendí mejor a como usar el "if" y los botones entre si.

No hay comentarios:

Publicar un comentario