本文整理汇总了Java中android.graphics.drawable.StateListDrawable.getCurrent方法的典型用法代码示例。如果您正苦于以下问题:Java StateListDrawable.getCurrent方法的具体用法?Java StateListDrawable.getCurrent怎么用?Java StateListDrawable.getCurrent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.drawable.StateListDrawable
的用法示例。
在下文中一共展示了StateListDrawable.getCurrent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCreateStateList
import android.graphics.drawable.StateListDrawable; //导入方法依赖的package包/类
/**
* Tests the {@link Coloring#createStateList(Context, int, int, int, boolean, int)} method.
* <p>
* Unfortunately {@link StateListDrawable#getCurrent()} is not shadowed by Robolectric yet.
*/
@Test
public final void testCreateStateList() {
final int colorNormal = Color.WHITE;
final int colorActive = Color.GRAY;
final int colorFocused = Color.YELLOW;
final StateListDrawable drawable = Coloring.createStateList(mActivityContext, colorNormal, colorActive, colorFocused, true, 0);
assertNotNull("StateListDrawable is null", drawable);
drawable.setState(new int[] {});
assertTrue("StateListDrawable is not stateful", drawable.isStateful());
final Drawable.ConstantState constantState = drawable.getConstantState();
assertNotNull("Constant state is null", constantState);
final Drawable currentState = drawable.getCurrent();
assertNull("Robolectric started shadowing current state", currentState);
}