android spinner对目标19的涟漪效应
你好,我想做的一切,如下图所示 为此,我为行项目创建了一个自定义视图android spinner对目标19的涟漪效应,android,android-spinner,Android,Android Spinner,你好,我想做的一切,如下图所示 为此,我为行项目创建了一个自定义视图 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
>
<com.andexert.library.RippleView
android:id="@+id/more1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/tvspinnerlist"
android:text="Spinner List"
android:singleLine="false"
android:textAppearance="?android:attr/textAppearanceMedium"
android:padding="4dp"
android:fontFamily="sans-serif-medium"
android:textColor="@color/black"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_marginRight="5dp"
android:layout_marginLeft="3dp"
android:ellipsize="marquee" />
</com.andexert.library.RippleView>
</RelativeLayout>
这是我的纺纱机
<com.andexert.library.RippleView
android:id="@+id/more1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<Spinner
android:id="@+id/spnOperator"
style="?android:label"
android:descendantFocusability="blocksDescendants"
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.17" />
</com.andexert.library.RippleView>
为此,我面临两个问题
谢谢,您基本上有两种方式:
Spinner.setBackgroundResource(R.drawable.Spinner\u background)上的背景代码>李>
使用主题进行此操作。如下定义微调器:(在activity.xml中的某处)
ripple_background.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<ripple android:color="?android:attr/colorControlHighlight">
<item>
<shape>
<solid android:color="@android:color/white" />
</shape>
</item>
</ripple>
</item>
</selector>
基本上有两种方法:
在res/values-v21/中创建RippleDrawable,并将其设置为微调器Spinner.setBackgroundResource(R.drawable.Spinner\u background)上的背景代码>李>
使用主题进行此操作。如下定义微调器:(在activity.xml中的某处)
ripple_background.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<ripple android:color="?android:attr/colorControlHighlight">
<item>
<shape>
<solid android:color="@android:color/white" />
</shape>
</item>
</ripple>
</item>
</selector>
你应该在发布之前格式化你的xml为什么不加载库?我制作了与你提供的图像中相同的微调器。如果你愿意,我可以发布我的答案。你应该在发布之前格式化你的xml为什么不加载库?我制作了与你提供的图像中相同的微调器。如果你愿意,我可以发布我的答案喜欢