1

I need your help !

I would like make a dropdown list in Xamarin Forms. I have a button in my xaml and when there is a click event, I would like that a list appear bottom this button. Look at pictures !

Thanks you in advance !

List not visible / List visible and on foreground when image clicked

1 Answer 1

-1
yourlayout.xml
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<Button
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="click"
    android:id="@+id/click"/>
<ListView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:visibility="invisible"
    android:layout_below="@+id/click"
    android:paddingLeft="30dp"
    android:paddingRight="30dp"
    android:id="@+id/list"/>
</RelativeLayout>

on your activity 
ListView list = (ListView) findViewById(R.id.list);
final Button click = (Button) findViewById(R.id.click)
 click.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            list.setVisibility(list.getVisibility() == View.INVISIBLE ? View.VISIBLE : View.INVISIBLE);
});
1
  • Thanks, but I think that with this solution, listview don't appear on foreground. Moreover, I would like a solution to Xamarin forms (In the project PCL) if it's possible.
    – R.Extrant
    May 17, 2016 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.