本文整理匯總了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;
}