本文整理汇总了Java中android.widget.EditText.post方法的典型用法代码示例。如果您正苦于以下问题:Java EditText.post方法的具体用法?Java EditText.post怎么用?Java EditText.post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.EditText
的用法示例。
在下文中一共展示了EditText.post方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showSoftkey
import android.widget.EditText; //导入方法依赖的package包/类
public void showSoftkey(final EditText inputTarget) {
postOnKeyboardOpen(new Runnable() {
@Override public void run() {
hideAttachedInput(true);
}
});
inputTarget.post(new Runnable() {
@Override public void run() {
inputTarget.requestFocus();
ServiceUtil.getInputMethodManager(inputTarget.getContext()).showSoftInput(inputTarget, 0);
}
});
}
示例2: showNewNetworkProxyDialog
import android.widget.EditText; //导入方法依赖的package包/类
private void showNewNetworkProxyDialog(final ProxyAdapter proxyAdapter) {
final int originalSelection = networkProxyAddress.isSet() ? ProxyAdapter.PROXY : ProxyAdapter.NONE;
View view = LayoutInflater.from(app).inflate(R.layout.debug_drawer_network_proxy, null);
final EditText hostView = findById(view, R.id.debug_drawer_network_proxy_host);
if (networkProxyAddress.isSet()) {
String host = networkProxyAddress.get().getHostName();
hostView.setText(host); // Set the current host.
hostView.setSelection(0, host.length()); // Pre-select it for editing.
// Show the keyboard. Post this to the next frame when the dialog has been attached.
hostView.post(() -> Keyboards.showKeyboard(hostView));
}
new AlertDialog.Builder(getContext()) //
.setTitle("Set Network Proxy")
.setView(view)
.setNegativeButton("Cancel", (dialog, i) -> {
networkProxyView.setSelection(originalSelection);
dialog.cancel();
})
.setPositiveButton("Use", (dialog, i) -> {
String in = hostView.getText().toString();
InetSocketAddress address = InetSocketAddressPreferenceAdapter.parse(in);
if (address != null) {
networkProxyAddress.set(address);
// Force a restart to re-initialize the app with the new proxy.
ProcessPhoenix.triggerRebirth(getContext());
} else {
networkProxyView.setSelection(originalSelection);
}
})
.setOnCancelListener(dialogInterface -> networkProxyView.setSelection(originalSelection))
.show();
}
示例3: show
import android.widget.EditText; //导入方法依赖的package包/类
public void show() {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(titleRes);
View view = View.inflate(context, R.layout.dialog_enter_text, null);
final EditText input = (EditText) view.findViewById(R.id.editText);
input.setText(value);
input.setSelection(input.getText().length());
if (hint != null) {
input.setHint(hint);
}
input.setInputType(inputType);
builder.setView(view);
builder.setPositiveButton(R.string.button_ok, null);
builder.setNegativeButton(R.string.button_cancel, (dialog, which) -> dialog.cancel());
final AlertDialog alertDialog = builder.create();
alertDialog.setOnShowListener(dialog -> {
Button b = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
b.setOnClickListener(view1 -> {
input.setError(null);
String newValue = input.getText().toString().trim();
if (TextUtils.isEmpty(newValue) && !allowEmpty) {
input.setError(context.getString(R.string.field_is_required));
input.requestFocus();
} else {
try {
if (validator != null) {
validator.validate(newValue);
}
if (callback != null) {
callback.onChanged(newValue);
}
if (target != null) {
target.setText(newValue);
}
alertDialog.dismiss();
} catch (IllegalArgumentException e) {
input.setError(e.getMessage());
input.requestFocus();
}
}
});
});
alertDialog.setOnDismissListener(onDismissListener);
alertDialog.show();
input.post(() -> {
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(input, InputMethodManager.SHOW_IMPLICIT);
});
}
示例4: initViews
import android.widget.EditText; //导入方法依赖的package包/类
private void initViews(){
mContentView = LayoutInflater.from(mContext)
.inflate(R.layout.item_wave_loading_view, mViewGroup, false);
mWaveLoadingView = (WaveLoadingView) mContentView.findViewById(R.id.wave_loading_view);
mWaveLoadingView.post(new Runnable() {
@Override
public void run() {
mWaveLoadingView.setWaveColor(mBookshelf.getColor());
}
});
mRedPicker = (SeekBar) mContentView.findViewById(R.id.red_picker);
mGreenPicker = (SeekBar) mContentView.findViewById(R.id.green_picker);
mBluePicker = (SeekBar) mContentView.findViewById(R.id.blue_picker);
mAmpPicker = (SeekBar) mContentView.findViewById(R.id.amp_picker);
mWavePicker = (SeekBar) mContentView.findViewById(R.id.wave_picker);
mCurrentPage = (EditText) mContentView.findViewById(R.id.edit_current_page);
mTotalPages = (TextView) mContentView.findViewById(R.id.text_total_page);
mConfirmButton = (Button) mContentView.findViewById(R.id.button_confirm);
//mCancelButton = (Button) mContentView.findViewById(R.id.button_cancel);
mRedPicker.post(new Runnable() {
@Override
public void run() {
mRedPicker.setProgress( (int)((mBookshelf.getRed() / 255.0f) * 100));
}
});
mGreenPicker.post(new Runnable() {
@Override
public void run() {
mGreenPicker.setProgress((int)((mBookshelf.getGreen() / 255.0f) * 100));
}
});
mBluePicker.post(new Runnable() {
@Override
public void run() {
mBluePicker.setProgress((int)((mBookshelf.getBlue() / 255.0f) * 100));
}
});
mAmpPicker.post(new Runnable() {
@Override
public void run() {
//范围是0~1
mAmpPicker.setProgress((int) (mBookshelf.getAmpratio() * 100));
}
});
mWavePicker.post(new Runnable() {
@Override
public void run() {
mWavePicker.setProgress((int) (mBookshelf.getWaveratio() * 100));
}
});
mCurrentPage.post(new Runnable() {
@Override
public void run() {
mCurrentPage.setText(""+mBookshelf.getCurrentpage());
}
});
mTotalPages.post(new Runnable() {
@Override
public void run() {
mTotalPages.setText("of "+mBookshelf.getTotalpage());
}
});
//mWaveLoadingView.setProgress(mBookshelf.getProgress());
Log.e("此时progress是",mBookshelf.getProgress()+"");
mWaveLoadingView.setTitletext(((int)(mBookshelf.getProgress() * 100)) + "" + " %");
}