Practica 2: ”ScrollView en Android”
Aplicación:La pantallase encuentradivididaendospartesiguales,estaspartestienenun
ScrollViewcadauna,perocon diferentesorientaciones,ycadaScrollView tienevariosbotones.
Código:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.lap_c_pc38.myapplication2.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/button74"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button81"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button80"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button79"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button78"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button77"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button76"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button75"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button72"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
</ScrollView>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:id="@+id/button109"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="Button" />
<Button
android:id="@+id/button122"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="Button" />
<Button
android:id="@+id/button121"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="Button" />
<Button
android:id="@+id/button120"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="Button" />
<Button
android:id="@+id/button119"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="Button" />
<Button
android:id="@+id/button118"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="Button" />
<Button
android:id="@+id/button117"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="Button" />
<Button
android:id="@+id/button110"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="Button" />
<Button
android:id="@+id/button111"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="Button" />
<Button
android:id="@+id/button112"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="Button" />
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
</android.support.constraint.ConstraintLayout>
Captura:
Conclusión:En estaactividadaprendíque se puedencombinardiferentesobjetosparaorganizary
hacer diferentescosasque soloarrastrandocosasno se puedenhacer.

Practica 2

  • 1.
    Practica 2: ”ScrollViewen Android” Aplicación:La pantallase encuentradivididaendospartesiguales,estaspartestienenun ScrollViewcadauna,perocon diferentesorientaciones,ycadaScrollView tienevariosbotones. Código: <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.lap_c_pc38.myapplication2.MainActivity"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <Button android:id="@+id/button74" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Button" /> <Button android:id="@+id/button81" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Button" /> <Button android:id="@+id/button80" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Button" /> <Button android:id="@+id/button79" android:layout_width="match_parent"
  • 2.
    android:layout_height="wrap_content" android:text="Button" /> <Button android:id="@+id/button78" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Button" /> <Button android:id="@+id/button77" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Button"/> <Button android:id="@+id/button76" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Button" /> <Button android:id="@+id/button75" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Button" /> <Button android:id="@+id/button72" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Button" /> </LinearLayout> </ScrollView> <HorizontalScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1"> <LinearLayout android:layout_width="wrap_content" android:layout_height="match_parent" android:orientation="horizontal"> <Button android:id="@+id/button109" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:text="Button" /> <Button android:id="@+id/button122" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1"
  • 3.
    android:text="Button" /> <Button android:id="@+id/button121" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:text="Button" /> <Button android:id="@+id/button120" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:text="Button"/> <Button android:id="@+id/button119" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:text="Button" /> <Button android:id="@+id/button118" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:text="Button" /> <Button android:id="@+id/button117" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:text="Button" /> <Button android:id="@+id/button110" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:text="Button" /> <Button android:id="@+id/button111" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:text="Button" /> <Button android:id="@+id/button112" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:text="Button" />
  • 4.
    </LinearLayout> </HorizontalScrollView> </LinearLayout> </android.support.constraint.ConstraintLayout> Captura: Conclusión:En estaactividadaprendíque sepuedencombinardiferentesobjetosparaorganizary hacer diferentescosasque soloarrastrandocosasno se puedenhacer.