Android Spinner边界问题
我已经使旋转器工作完美,但设计问题。 我的微调器代码是Android Spinner边界问题,android,Android,我已经使旋转器工作完美,但设计问题。 我的微调器代码是 <Spinner android:id="@+id/product" android:layout_width="match_parent" android:layout_height="wrap_content" android:drawable="@drawable/border" android:padding="25dp"> <
<Spinner
android:id="@+id/product"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawable="@drawable/border"
android:padding="25dp">
</Spinner>
Java代码
spinnerShop = (Spinner) myView.findViewById(R.id.shop);
/*Shop Spinner*/
ArrayAdapter<CharSequence> shopArray = ArrayAdapter.createFromResource(getActivity(),
R.array.shopArray, android.R.layout.simple_list_item_1);
shopArray.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerShop.setAdapter(shopArray);
spinnerShop=(Spinner)myView.findviewbyd(R.id.shop);
/*车间纺纱机*/
ArrayAdapter shopArray=ArrayAdapter.createFromResource(getActivity(),
R.array.shopArray,android.R.layout.simple\u list\u item\u 1);
setDropDownViewResource(android.R.layout.simple\u微调器\u下拉菜单\u项);
喷丝头车间.设置适配器(车间阵列);
@可提取/边界代码
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:radius="2dp" />
<solid android:color="@color/colorText" />
<stroke
android:width="1dip"
android:color="@color/colorPrimary"/>
</shape>
微调器周围未显示边框
显示图像
您需要在style.xml文件中为微调器定义自定义样式。然后将此自定义样式指定给微调器,如下所示:
<Spinner
android:id="@+id/product"
style="@style/your_custom_spinner_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="25dp"/>
<style name="your_custom_spinner_style">
<item name="android:background">@drawable/border_code</item>
........
</style>
您将在style.xml文件中的\u自定义\u微调器\u样式中使用@drawable/border\u代码,如下所示:
<Spinner
android:id="@+id/product"
style="@style/your_custom_spinner_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="25dp"/>
<style name="your_custom_spinner_style">
<item name="android:background">@drawable/border_code</item>
........
</style>
@可提取/边界代码
........
试用后请通知我。您需要在style.xml文件中为微调器定义自定义样式。然后将此自定义样式指定给微调器,如下所示:
<Spinner
android:id="@+id/product"
style="@style/your_custom_spinner_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="25dp"/>
<style name="your_custom_spinner_style">
<item name="android:background">@drawable/border_code</item>
........
</style>
您将在style.xml文件中的\u自定义\u微调器\u样式中使用@drawable/border\u代码,如下所示:
<Spinner
android:id="@+id/product"
style="@style/your_custom_spinner_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="25dp"/>
<style name="your_custom_spinner_style">
<item name="android:background">@drawable/border_code</item>
........
</style>
@可提取/边界代码
........
试用后请通知我。这样显示边框,但微调器箭头不显示。这样显示边框,但微调器箭头不显示。