我正在使用VerticalStepperForm来实现这样的调查表:
诊断活动.java
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import com.diasni.app.diagnosa.steps.StepPertanyaan;
import ernestoyaquello.com.verticalstepperform.VerticalStepperFormView;
import ernestoyaquello.com.verticalstepperform.listener.StepperFormListener;
public class DiagnosaActivity extends AppCompatActivity implements StepperFormListener {
VerticalStepperFormView verticalStepperForm;
StepPertanyaan pertanyaan01, pertanyaan02, pertanyaan03, pertanyaan04, pertanyaan05, pertanyaan06, pertanyaan07,
pertanyaan08, pertanyaan09, pertanyaan10;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_diagnosa);
pertanyaan01 = new StepPertanyaan("Apakah perut kanan bawah anda sakit?");
pertanyaan02 = new StepPertanyaan("Apakah anda demam?");
pertanyaan03 = new StepPertanyaan("Apakah anda mual?");
pertanyaan04 = new StepPertanyaan("Apakah anda muntah?");
pertanyaan05 = new StepPertanyaan("Apakah anda tidak nafsu makan?");
pertanyaan06 = new StepPertanyaan("Apakah anda merasa lelah?");
pertanyaan07 = new StepPertanyaan("Apakah anda sering buang air kecil?");
pertanyaan08 = new StepPertanyaan("Apakah anda diare?");
pertanyaan09 = new StepPertanyaan("Apakah nyeri pinggang belakang anda?");
pertanyaan10 = new StepPertanyaan("Apakah anda pusing?");
verticalStepperForm = findViewById(R.id.stepper_form);
verticalStepperForm.setup(this, pertanyaan01, pertanyaan02, pertanyaan03, pertanyaan04, pertanyaan05
, pertanyaan06, pertanyaan07, pertanyaan08, pertanyaan09, pertanyaan10).init();
}
@Override
public void onCompletedForm() {
}
@Override
public void onCancelledForm() {
}
}
StepPertanyaan.java
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import com.diasni.app.diagnosa.R;
import ernestoyaquello.com.verticalstepperform.Step;
public class StepPertanyaan extends Step<String> {
RadioGroup rgJawaban;
RadioButton rbSelected;
View content;
public StepPertanyaan(String title){
this(title, "");
}
public StepPertanyaan(String title, String subtitle){
super(title, subtitle);
}
@Override
public String getStepData() {
int selectedRadioId = rgJawaban.getCheckedRadioButtonId();
if (selectedRadioId > -1) {
rbSelected = (RadioButton) content.findViewById(selectedRadioId);
return rbSelected.getText().toString();
}
else return "";
}
@Override
public String getStepDataAsHumanReadableString() {
int selectedRadioId = rgJawaban.getCheckedRadioButtonId();
if (selectedRadioId > -1) {
rbSelected = (RadioButton) content.findViewById(selectedRadioId);
return rbSelected.getText().toString();
}
else return "";
}
@Override
public void restoreStepData(String data) {
}
@Override
protected IsDataValid isStepDataValid(String stepData) {
return null;
}
@Override
protected View createStepContentLayout() {
LayoutInflater inflater = LayoutInflater.from(getContext());
content = inflater.inflate(R.layout.layout_pertanyaan, null, false);
rgJawaban = (RadioGroup) content.findViewById(R.id.rgJawaban);
return content;
}
@Override
protected void onStepOpened(boolean animated) {
}
@Override
protected void onStepClosed(boolean animated) {
}
@Override
protected void onStepMarkedAsCompleted(boolean animated) {
}
@Override
protected void onStepMarkedAsUncompleted(boolean animated) {
}
}
构建.gradle
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.ernestoyaquello.stepperform:vertical-stepper-form:2.2.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
问题已经是印尼语了。继续按钮,当然不是。那怎么改标题呢?我已经查看了 Github 存储库,到目前为止,您似乎必须修改和重建 VerticalStepperForm 库。不过,也许我错过了一些东西。