Created
October 11, 2018 00:13
-
-
Save thbighead/395c6ce3d645c86f614921c8993ee298 to your computer and use it in GitHub Desktop.
Doideira com recuperação de imagens
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout 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=".MainActivity"> | |
<Button | |
android:id="@+id/btnFoto1" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_alignParentStart="true" | |
android:layout_centerVertical="true" | |
android:layout_marginStart="74dp" | |
android:onClick="exibir1" | |
android:text="EXIBE FOTO 1" /> | |
<Button | |
android:id="@+id/btnFoto2" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_alignParentEnd="true" | |
android:layout_centerVertical="true" | |
android:layout_marginEnd="64dp" | |
android:onClick="exibir2" | |
android:text="EXIBE FOTO 2" /> | |
<TextView | |
android:id="@+id/txtInformacao" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_alignParentEnd="true" | |
android:layout_alignParentTop="true" | |
android:layout_marginEnd="93dp" | |
android:layout_marginTop="188dp" | |
android:text="Informação" /> | |
<ImageView | |
android:id="@+id/imgfoto" | |
android:layout_width="59dp" | |
android:layout_height="54dp" | |
android:layout_alignParentStart="true" | |
android:layout_alignParentTop="true" | |
android:layout_marginStart="107dp" | |
android:layout_marginTop="169dp" | |
app:srcCompat="@android:color/holo_blue_bright" /> | |
</RelativeLayout> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package projetolc.usuario.app.anotherdoideira; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.view.View; | |
import android.widget.Button; | |
import android.widget.ImageView; | |
import android.widget.TextView; | |
public class MainActivity extends AppCompatActivity { | |
ImageView imgfoto; | |
Button btnFoto1, btnFoto2; | |
TextView txtInformacao; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
imgfoto = (ImageView) findViewById(R.id.imgfoto); | |
btnFoto1 = (Button) findViewById(R.id.btnFoto1); | |
btnFoto2 = (Button) findViewById(R.id.btnFoto2); | |
txtInformacao = (TextView) findViewById(R.id.txtInformacao); | |
} | |
public void exibir1 (View v) { | |
imgfoto.setImageResource(R.drawable.android1); | |
txtInformacao.setText("Foto 1"); | |
} | |
public void exibir2 (View v) { | |
imgfoto.setImageResource(R.drawable.android2); | |
txtInformacao.setText("Foto 2"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment