我正在使用guidedstepfragment开发瘦身应用程序。我想使用GuidedActionEditText,但不知道如何使用,Google对此的评价很低。
明确地说,我想将GuidedActionEditText添加到GuidedActions列表中,但是不能这样做。
谢谢
答案 0 :(得分:0)
您好,请找到GuidedActionEditText的示例。
public class NameEditFragment extends GuidedStepSupportFragment {
private static final String TAG = "NameEditFragment";
private final int ACTION_NAME = 0;
@Override
public int onProvideTheme() {
return R.style.Guidestyle;
}
private void addEditableAction(List<GuidedAction> actions,long id, String title, String desc,int inputType){
actions.add(new GuidedAction.Builder(getActivity())
.id(id)
.editable(true)
.title(title).inputType(inputType)
.build());
}
@NonNull
@Override
public GuidanceStylist.Guidance onCreateGuidance(Bundle savedInstanceState) {
GuidanceStylist.Guidance guidance = new GuidanceStylist.Guidance("Edit your Alias “, "", "", null);
return guidance;
}
@Override
public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
addEditableAction(actions,ACTION_NAME,"Name","", InputType.TYPE_CLASS_TEXT);
}
@Override
public long onGuidedActionEditedAndProceed(GuidedAction action) {
if (action.getId() == ACTION_NAME) {
}
return super.onGuidedActionEditedAndProceed(action)
}}
指南样式
<style name="GuidedActionItemTitleStyle">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:alpha">@string/lb_guidedactions_item_unselected_text_alpha</item>
<item name="android:ellipsize">end</item>
<item name="android:fontFamily">sans-serif-condensed</item>
<item name="android:textColor">@color/lb_guidedactions_item_unselected_text_color</item>
<item name="android:textSize">@dimen/lb_guidedactions_item_title_font_size</item>
<item name="android:singleLine">true</item>
<item name="android:background">@android:color/transparent</item>
<item name="android:maxLength">32</item>
<item name="android:textAlignment">viewStart</item>