Android自定义微调器布局
我为微调器创建了自定义布局,并且在微调器上选择一些选项时效果良好。但当您选择项目时,布局不起作用 我在左边粘贴了一个图像,左边是微调器下拉列表,这样你可以选择一些东西,右边是当你选择了一个选项时的微调器 如右图所示,自定义布局不起作用 我的自定义布局是:Android自定义微调器布局,android,spinner,Android,Spinner,我为微调器创建了自定义布局,并且在微调器上选择一些选项时效果良好。但当您选择项目时,布局不起作用 我在左边粘贴了一个图像,左边是微调器下拉列表,这样你可以选择一些东西,右边是当你选择了一个选项时的微调器 如右图所示,自定义布局不起作用 我的自定义布局是: <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android"
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:gravity="left"
android:textColor="@color/colorblanco"
android:background="@color/colorfondosuperior"
android:padding="5dip"
/>
知道如何在不在下拉列表中时将自定义布局应用于微调器吗
谢谢。自定义版面的
TextView
有id@+id/TextView
TextView spinnerdata = (TextView) findViewById(R.id.textview);
public void onItemSelected(AdapterView<?> parent, View view, int position, long id)
{
String item = parent.getItemAtPosition(position).toString();
spinnerdata.setText(item);
}
TextView喷丝头数据=(TextView)findViewById(R.id.TextView);
已选择公共视图(AdapterView父视图、视图视图、整型位置、长id)
{
String item=parent.getItemAtPosition(position.toString();
喷丝头数据.设置文本(项目);
}
Hi Sunil,这两个都是微调器,但左侧的微调器会被单击,右侧的微调器不会被单击以显示如何显示。该图像上没有文本视图。当微调器不在DropDownView中时,我要更改的是微调器文本的颜色。