本文整理了Java中android.widget.Spinner.getPaddingRight()
方法的一些代码示例,展示了Spinner.getPaddingRight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spinner.getPaddingRight()
方法的具体详情如下:
包路径:android.widget.Spinner
类名称:Spinner
方法名:getPaddingRight
暂无
代码示例来源:origin: stackoverflow.com
Spinner s = (Spinner) findViewById(R.id.spinner);
s.setPadding(0, s.getPaddingTop(), s.getPaddingRight(), s.getPaddingBottom());
代码示例来源:origin: Ronak-LM/memoir
private <T extends SpinnerItem> SpinnerItemAdapter<T> createDropDownNav(Spinner spinner, int spinnerId, int spinnerItemId,
SpinnerItems<T> spinnerItems,
final DropDownNavListener<T> listener) {
if (spinner != null) {
Context context = getContext();
// create custom adapter
final SpinnerItemAdapter<T> dropDownNavAdapter = new SpinnerItemAdapter<>(context, spinnerItems, spinnerId, spinnerItemId);
// configure spinner
spinner.setPadding(spinner.getPaddingLeft(), 0, spinner.getPaddingRight(), 0);
spinner.setAdapter(dropDownNavAdapter);
// we need this because otherwise the first item will be selected by
// default and the OnItemSelectedListener won't get called
spinner.setSelection(spinnerItems.getSelectedItem());
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
private AtomicBoolean mFirstCall = new AtomicBoolean(true);
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (!mFirstCall.getAndSet(false) && dropDownNavAdapter.getSelectedItem() != position) {
listener.onItemSelected(dropDownNavAdapter.getItem(position), position);
}
dropDownNavAdapter.setSelectedItem(position);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
return dropDownNavAdapter;
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!