本文整理汇总了Java中android.widget.SeekBar.setTag方法的典型用法代码示例。如果您正苦于以下问题:Java SeekBar.setTag方法的具体用法?Java SeekBar.setTag怎么用?Java SeekBar.setTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.SeekBar
的用法示例。
在下文中一共展示了SeekBar.setTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getView
import android.widget.SeekBar; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TGChannel channel = (TGChannel) this.getItem(position);
View view = (convertView != null ? convertView : getLayoutInflater().inflate(R.layout.view_channel_list_item, parent, false));
view.setTag(channel);
view.setOnClickListener(this.channelList.getActionHandler().createEditChannelAction(channel));
view.setOnLongClickListener(this.channelList.getActionHandler().createChannelItemMenuAction(channel));
TextView textViewName = (TextView) view.findViewById(R.id.channel_item_name);
textViewName.setText(channel.getName());
SeekBar seekBarVolume = (SeekBar) view.findViewById(R.id.channel_item_volume_value);
seekBarVolume.setTag(channel);
seekBarVolume.setProgress(channel.getVolume());
seekBarVolume.setOnSeekBarChangeListener(this.createVolumeChangeListener());
return view;
}
示例2: createDialog
import android.widget.SeekBar; //导入方法依赖的package包/类
private Dialog createDialog() {
if (mDialog != null) return mDialog;
Activity activity = mActivity;
// load main view
final LayoutInflater factory = LayoutInflater.from(activity);
final View dialog = factory.inflate(R.layout.settings_volume_streams, null);
final ViewGroup parent = (ViewGroup) dialog.findViewById(R.id.placeholder);
// local cache
final int[] stringIds = STRING_IDS;
final int length = stringIds.length;
final SeekBar[] seekBars = mSeekBars = new SeekBar[length];
final TextView[] valueViews = mValueViews = new TextView[length];
mVolumes = new int[length];
// add controls for all stream
for (int i=0; i<length; i++) {
View control = factory.inflate(R.layout.row_volume, null);
// init text
TextView text = (TextView) control.findViewById(R.id.text);
text.setText(stringIds[i]);
// init values
valueViews[i] = (TextView) control.findViewById(R.id.value);
// init seekbars
SeekBar seekBar = (SeekBar) control.findViewById(R.id.seekbar);
seekBar.setOnSeekBarChangeListener(this);
seekBar.setId(mIdCounter++); // workaround for seekbar id bug
seekBar.setTag(i);
seekBars[i] = seekBar;
// add to parent
parent.addView(control);
//Log.d(TAG, "create: index: " + i + ", seekbar: " + seekBar);
}
AlertDialog d = new AlertDialog.Builder(activity)
.setIcon(R.drawable.ic_dialog_menu_generic)
.setTitle(R.string.txt_volume)
.setView(dialog)
.setPositiveButton(R.string.btn_set, this)
.setNegativeButton(R.string.btn_calcel, this)
.create();
d.setOnCancelListener(this);
return d;
}