本文整理匯總了Java中android.widget.EditText.setMovementMethod方法的典型用法代碼示例。如果您正苦於以下問題:Java EditText.setMovementMethod方法的具體用法?Java EditText.setMovementMethod怎麽用?Java EditText.setMovementMethod使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.EditText
的用法示例。
在下文中一共展示了EditText.setMovementMethod方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onViewCreated
import android.widget.EditText; //導入方法依賴的package包/類
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
clickHandler = new ClickHandler(this);
txtDialogTitle = (TextView) view.findViewById(R.id.txtDialogTitle);
txtContent = (TextView) view.findViewById(R.id.txtContent);
btnOk = (TextView) view.findViewById(R.id.btnOk);
btnExit = (TextView) view.findViewById(R.id.btnExit);
btnCancel = (TextView) view.findViewById(R.id.btnCancel);
edtLibName = (EditText) view.findViewById(R.id.edtLibName);
btnOk.setOnClickListener(clickHandler);
btnExit.setOnClickListener(clickHandler);
btnCancel.setOnClickListener(clickHandler);
txtContent.setText(content);
btnOk.setText(ok);
btnCancel.setText(cancel);
btnExit.setText(exit);
if (!TextUtils.isEmpty(sDialogTitle)) {
txtDialogTitle.setText(sDialogTitle);
}
if (btnCount == 1) {
btnCancel.setVisibility(View.GONE);
} else if (btnCount == 3) {
btnExit.setVisibility(View.VISIBLE);
}
int visibility = hasEditText ? View.VISIBLE : View.GONE;
edtLibName.setVisibility(visibility);
if (!TextUtils.isEmpty(textContent)) {
edtLibName.setText(textContent);
}
if (!TextUtils.isEmpty(hintText)) {
edtLibName.setHint(hintText);
}
if (isMultiLineEditText) {
edtLibName.setMaxLines(1);
edtLibName.setImeOptions(EditorInfo.IME_FLAG_NO_ENTER_ACTION);
edtLibName.setScroller(new Scroller(getContext()));
edtLibName.setVerticalScrollBarEnabled(true);
edtLibName.setMovementMethod(new ScrollingMovementMethod());
}
}