How can we do a custom control in Android Xamarin ?

Hi everyone, i am a beginner in Xamarin. I ask you this question because i want to make a custom button, with an image on the left side, a text in the middle, and a ">" on the right side.
This is the expected render :

And this is the expected Xaml Code for using the custom button

<buttontest.customcontrol.ButtonMenu
android:id="@+id/MyButton"
android:text="Good Bye"
ImageSrc="@drawable/home"/>;

With the android:text property, i can modify the text on the middle.
With the ImageSrc property, i can change the image on the left side.

Have you a solution to do that ?

Thanks

Answers

  • ShamnadShamnad USMember ✭✭✭

    <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:baselineAligned="true"> <Button android:id="@+id/myButton" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="hello" android:drawableRight="@drawable/icon" android:drawableLeft="@drawable/icon" /> </LinearLayout>

    are you looking for something like this you can change the image as per your requirement

  • ShamnadShamnad USMember ✭✭✭

    @KenzySuon did you got the solution for your problem that you posted in forms ?

  • KenzySuonKenzySuon USMember

    Your answer is very usefull, thank you.
    But it's not what i wanted. I want to find a way to make a menu without repeat the code.

Sign In or Register to comment.