Skip to content

Instantly share code, notes, and snippets.

@jonatasleon
Last active October 11, 2017 17:22
Show Gist options
  • Save jonatasleon/324ba4a9d548df1b8fc750aea828e2ab to your computer and use it in GitHub Desktop.
Save jonatasleon/324ba4a9d548df1b8fc750aea828e2ab to your computer and use it in GitHub Desktop.
Criando uma Pokedex com Android
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_main"
tools:context="com.jonatasleon.pokedex.MainActivity">
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_pokemons"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
</RelativeLayout>
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:25.3.0'
// libs de compatibilidade
compile 'com.android.support:design:25.3.0'
compile 'com.android.support:recyclerview-v7:25.3.0'
// retrofit, gson, picasso
compile 'com.google.code.gson:gson:2.7'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
}
package com.jonatasleon.pokedex;
public class Pokemon {
private String name;
private String type;
public Pokemon() {
}
public Pokemon(String name, String type) {
this.name = name;
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:clickable="true"
android:background="?android:attr/selectableItemBackground"
android:orientation="vertical">
<TextView
android:id="@+id/tv_name"
android:textSize="16sp"
android:textStyle="bold"
android:layout_alignParentTop="true"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/tv_type"
android:layout_below="@id/tv_name"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment