Add tools attributes to set extreme values for NumberPicker
tools:minValue and tools:maxValue can now be used to specify the min and max values of a NumberPicker in the layout editor. Bug: http://b.android.com/205084 Change-Id: I10037726346c82ca3cf84d255727b84a12ac0349 (cherry picked from commit 3c2b1c65c907fa4f2cae102507688fd0bffd1b24)
This commit is contained in:
committed by
Diego Perez
parent
4a1bd4995e
commit
1d8b0bb6cc
@@ -39,6 +39,7 @@ import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.NumberPicker;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
@@ -300,6 +301,17 @@ public final class BridgeInflater extends LayoutInflater {
|
||||
getDrawerLayoutMap().put(view, attrVal);
|
||||
}
|
||||
}
|
||||
else if (view instanceof NumberPicker) {
|
||||
NumberPicker numberPicker = (NumberPicker) view;
|
||||
String minValue = attrs.getAttributeValue(BridgeConstants.NS_TOOLS_URI, "minValue");
|
||||
if (minValue != null) {
|
||||
numberPicker.setMinValue(Integer.parseInt(minValue));
|
||||
}
|
||||
String maxValue = attrs.getAttributeValue(BridgeConstants.NS_TOOLS_URI, "maxValue");
|
||||
if (maxValue != null) {
|
||||
numberPicker.setMaxValue(Integer.parseInt(maxValue));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user