Ich mache eine App, wo es zwei Arten von Benutzern braucht. "Zuschauer" und "Auftragnehmer". Ich habe zwei Optionsfelder für jede Option erstellt. Ich möchte drei Dinge wissen: So aktivieren Sie eine Schaltfläche, wenn ein Optionsfeld ausgewählt ist. So deaktivieren Sie eine Schaltfläche, wenn keine Optionsschaltfläche ausgewählt ist. Zuletzt, wie Sie beide Radio-Buttons senden Sie eine einzigartige Aktivität abhängig von der gewählten Option. Zum Beispiel, ich wähle "Contractor" und dann die Taste, um fortzufahren, es wird mich zu einem einzigartigen Layout senden, das mit diesem Radio-Button verbindet.Wie man eine Radio-Taste eine Taste steuern
Hier ist meine XML:
<?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:id="@+id/b"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gradient_background"
tools:context="com.devteam.abire.abire.b">
<android.support.v7.widget.CardView
app:cardElevation="15dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_width="300dp"
android:layout_height="345dp">
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
app:cardElevation="20dp"
android:layout_width="320dp"
android:layout_height="320dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<View
android:background="#141526"
android:layout_width="match_parent"
android:layout_height="50dp"/>
<ImageView
android:id="@+id/abire_app_icon_v2"
android:layout_marginTop="21dp"
android:elevation="45dp"
android:layout_centerHorizontal="true"
android:background="@drawable/abire_logo_v1"
android:layout_width="55dp"
android:layout_height="55dp" />
<TextView
android:layout_marginStart="20dp"
android:id="@+id/register_as_text"
android:layout_marginTop="10dp"
android:text="Register As A..."
android:textColor="#141526"
android:layout_below="@+id/abire_app_icon_v2"
android:textSize="28sp"
android:textAlignment="textStart"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RadioButton
android:layout_marginStart="20dp"
android:textSize="22sp"
android:textColor="#141526"
android:id="@+id/viewer_radioBtn"
android:text="Viewer"
android:layout_marginTop="18dp"
android:layout_below="@+id/register_as_text"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RadioButton
android:layout_marginStart="20dp"
android:textSize="22sp"
android:textColor="#141526"
android:id="@+id/contractor_radioBtn"
android:text="Contractor"
android:layout_marginTop="18dp"
android:layout_below="@+id/viewer_radioBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/continueBtn"
android:textSize="18sp"
android:text="CONTINUE"
android:textColor="#fff"
android:layout_marginTop="25dp"
android:layout_centerHorizontal="true"
android:layout_below="@+id/contractor_radioBtn"
android:background="@drawable/ripple_maroon"
android:layout_width="250dp"
android:layout_height="38dp" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
Hier ist meine Java:
package com.devteam.abire.abire;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class b extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.b);
}
}
was bedeutet '.setEnabld' tun?, Hörte ich seine' .setEnabled' richtig? – W4R10CK
Ja, es war ein Tippfehler. Danke hat es geändert ..! –