Spinner without Dropdown
How to remove the dropdown from the spinner and when clicked on that spinner other activity or may be someother xml layout file should be displayed (like wheel widget) and after selecting parti开发者_JAVA技巧cular item from that wheel widget this activity should be invisible.
If you want to hide the dropdown
of your Spinner
you can use the following code in your layout.xml file for your Spinner
element :
android:background="@null"
For taking the click action on your spinner you can do the following :
public class MyActivity extends Activity implements OnItemSelectedListener{
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//....
mSpinner=(Spinner)findViewById(R.id.mySpinner);
public void onItemSelected(AdapterView<?> parent,
View view, int pos, long id) {
//maybe start another activity...
}
}
Instead of using exactly Spinner view you can use Button view and give it a spinner like image and in onClick show the layout you want .
精彩评论