本文整理汇总了Java中android.widget.HorizontalScrollView.getChildAt方法的典型用法代码示例。如果您正苦于以下问题:Java HorizontalScrollView.getChildAt方法的具体用法?Java HorizontalScrollView.getChildAt怎么用?Java HorizontalScrollView.getChildAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.HorizontalScrollView
的用法示例。
在下文中一共展示了HorizontalScrollView.getChildAt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getValue
import android.widget.HorizontalScrollView; //导入方法依赖的package包/类
@Override
public String getValue() {
if (getChildCount() == 0) return null;
HorizontalScrollView horizontalScrollView = (HorizontalScrollView) getChildAt(0);
RadioGroup rg = (RadioGroup) horizontalScrollView.getChildAt(0);
for (int i = 0; i < rg.getChildCount(); ++i) {
View view = rg.getChildAt(i);
if (view instanceof CustomRadioButton) {
CustomRadioButton rb = (CustomRadioButton) view;
if (rb.isChecked()) {
return rb.getValue();
}
}
}
return null;
}
示例2: setValue
import android.widget.HorizontalScrollView; //导入方法依赖的package包/类
@Override
public void setValue(String value) {
if (getChildCount() == 0) return;
HorizontalScrollView horizontalScrollView = (HorizontalScrollView) getChildAt(0);
RadioGroup rg = (RadioGroup) horizontalScrollView.getChildAt(0);
List<CustomRadioButton> buttons = new ArrayList<CustomRadioButton>();
for (int i = 0; i < rg.getChildCount(); ++i) {
View view = rg.getChildAt(i);
if (view instanceof CustomRadioButton) {
buttons.add((CustomRadioButton) view);
}
}
rg.removeAllViews();
for (CustomRadioButton rb : buttons) {
CustomRadioButton radioButton = new CustomRadioButton(
rg.getContext());
radioButton.setText(rb.getText());
radioButton.setValue(rb.getValue());
if (rb.getValue().toString()
.equalsIgnoreCase(value)) {
radioButton.setChecked(true);
}
rg.addView(radioButton);
}
notifySave();
}
示例3: getPairs
import android.widget.HorizontalScrollView; //导入方法依赖的package包/类
public List<NameValuePair> getPairs() {
List<NameValuePair> pairs = new ArrayList<NameValuePair>();
HorizontalScrollView horizontalScrollView = (HorizontalScrollView) getChildAt(0);
RadioGroup rg = (RadioGroup) horizontalScrollView.getChildAt(0);
for (int i = 0; i < rg.getChildCount(); ++i) {
View view = rg.getChildAt(i);
if (view instanceof CustomRadioButton) {
CustomRadioButton rb = (CustomRadioButton) view;
pairs.add(new NameValuePair(rb.getText().toString(), rb.getValue()));
}
}
return pairs;
}