3
And I’d like to know how to take that part of the title because in this case, it’s unnecessary.
Code
private void acertou() {
final Dialog certo = new Dialog(this);
certo.setContentView(R.layout.resultado_positivo);
Button okPositivo = (Button) certo.findViewById(R.id.okPositivo);
okPositivo.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View e) {
dinheiro +=600;
actualizarRecompensa();
certo.dismiss();
}
});
certo.show();
}
And in the XML
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/fundo_dialogos"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Correcto!!!"
android:id="@+id/txtcerto"
android:layout_gravity="center_horizontal"
android:textStyle="bold"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="OK"
android:id="@+id/okPositivo"
android:layout_gravity="center_horizontal"
android:background="@drawable/seleccionador"
android:layout_marginTop="30dp"
android:textColor="#ffffff"
android:layout_below="@+id/txtcerto"
android:layout_centerHorizontal="true"
android:layout_marginBottom="5dp" />
</RelativeLayout>
How are you building the dialog? Enter the code.
– ramaral
There’s the code (I edited the question). XML and code in Java.
– António Macave