android.widget.Spinner.setTag()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(200)

本文整理了Java中android.widget.Spinner.setTag()方法的一些代码示例,展示了Spinner.setTag()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Spinner.setTag()方法的具体详情如下:
包路径:android.widget.Spinner
类名称:Spinner
方法名:setTag

Spinner.setTag介绍

暂无

代码示例

代码示例来源:origin: limboemu/limbo

private void addDiskMapping(FileType fileType, Spinner spinner, CheckBox enableCheckBox, String dbColName) {
  spinner.setTag(fileType);
  diskMapping.put(fileType, new DiskInfo(spinner, enableCheckBox, dbColName));
}

代码示例来源:origin: stackoverflow.com

for(int i=0;i<4;i++){
 final Spinner spinner= new Spinner(context);
 spinner.setTag(i);
 ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_dropdown_item, spinnerArray);
     spinner.setAdapter(spinnerArrayAdapter);
     spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
       @Override
       public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
           if (parent.getTag().equals("0")){
            //your code
              }
           else if (parent.getTag().equals("1")){
            //your code
              }
         }
       }
       @Override
       public void onNothingSelected(AdapterView<?> adapterView) {
       }
     });}

代码示例来源:origin: PrivacyApps/document-viewer

@Override
public View getChildView(final int groupPosition, final int childPosition, final boolean isLastChild,
    View convertView, final ViewGroup parent) {
  if (convertView == null) {
    convertView = LayoutInflater.from(getContext()).inflate(R.layout.keybinding_action, parent, false);
  }
  final KeyAction action = getChild(groupPosition, childPosition);
  final TextView keyView = (TextView) convertView.findViewById(R.id.keybinding_key);
  keyView.setText(action.label);
  final Spinner actionsView = (Spinner) convertView.findViewById(R.id.keybinding_actions);
  actionsView.setOnItemSelectedListener(this);
  actionsView.setAdapter(actionsAdapter);
  actionsView.setTag(action);
  updateAction(actionsView);
  return convertView;
}

代码示例来源:origin: proninyaroslav/libretorrent

@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l)
{
  if (((Integer)storageList.getTag()) == i)
    return;
  spinnerPos = i;
  storageList.setTag(i);
  curDir = storageAdapter.getItem(i);
  reloadData();
}

代码示例来源:origin: M66B/XPrivacyLua

private void updateSelection() {
    XGroup selected = (XGroup) spGroup.getSelectedItem();
    String group = (selected == null ? null : selected.name);
    if (group == null ? spGroup.getTag() != null : !group.equals(spGroup.getTag())) {
      Log.i(TAG, "Select group=" + group);
      spGroup.setTag(group);
      rvAdapter.setGroup(group);
    }
    tvRestrict.setVisibility(group == null ? View.VISIBLE : View.GONE);
    btnRestrict.setVisibility(group == null ? View.INVISIBLE : View.VISIBLE);
  }
});

代码示例来源:origin: stackoverflow.com

Toolbar toolbar = (Toolbar)getActivity().findViewById(R.id.toolbar);
 if(toolbar.findViewWithTag("spinner_nav")==null) {
   Spinner spinner = new Spinner(getActivity());
   spinner.setTag("spinner_nav");
   //Setting up the adapter
   AdapterFragmentOne spinnerAdapter = new AdapterFragmentOne(getActivity(), array);
   spinnerAdapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
   if (spinner != null) {
     spinner.setVisibility(View.VISIBLE);
     spinner.setAdapter(spinnerAdapter);
   }
   spinnerAdapter.notifyDataSetChanged();
   spinner.setOnItemSelectedListener(mOnNavigationListener);
   toolbar.addView(spinner);
 }

代码示例来源:origin: stackoverflow.com

Spinner leftAttributValues = new Spinner(this);
leftAttributValues.setAdapter(adapter);
leftAttributValues.setBackgroundResource(R.drawable.lenti_attributspinner);
leftAttributValues.setTag(attribut);

// get actual spinner params
LayoutParams params = (LayoutParams) leftAttributValues.getLayoutParams();
// modify desired params 
params.gravity = Gravity.CENTER_HORIZONTAL;
params.setMargins(10, 0, 0, 0);
// set modified params to spinner again
leftAttributValues.setLayoutParams(params);

代码示例来源:origin: M66B/XPrivacyLua

spGroup.setTag(null);
spGroup.setAdapter(spAdapter);
spGroup.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

代码示例来源:origin: PrivacyApps/document-viewer

stList.setTag(TouchManager.Touch.SingleTap);
stList.setOnItemSelectedListener(actionListener);
dtList.setTag(TouchManager.Touch.DoubleTap);
dtList.setOnItemSelectedListener(actionListener);
ltList.setTag(TouchManager.Touch.LongTap);
ltList.setOnItemSelectedListener(actionListener);
tftList.setTag(TouchManager.Touch.TwoFingerTap);
tftList.setOnItemSelectedListener(actionListener);

代码示例来源:origin: qiubiteme/android_api_demos

s.setVisibility(View.VISIBLE);
s.setAdapter(modeAdapter);
s.setTag(display);
s.setOnItemSelectedListener(PresentationActivity.this);

代码示例来源:origin: proninyaroslav/libretorrent

storageList = findViewById(R.id.storage_spinner);
storageList.setAdapter(storageAdapter);
storageList.setTag(spinnerPos);
storageList.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener()

相关文章