Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,377 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Xamarin Android C# using visual studio 2022 I am trying to create button with image and text but image is not showing.
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minWidth="500px"
android:minHeight="250px"
android:id="@+id/button1"
android:text="button"
android:background="@drawable/abc_ab_share_pack_mtrl_alpha"
android:drawableLeft="@drawable/picture1"/>
I had already tried this link
http://cheahengsoon.weebly.com/blog/button-style-in-xamarinandroid
please solve my problem thanks.
@Ibrar Tariq , In Xamarin.Android, to create a Button with both an image and text, you can use a combination of android:drawableLeft or android:drawableStart (depending on the layout direction) and android:text attributes. Here's how you can modify your XML layout to achieve this:
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minWidth="500px"
android:minHeight="250px"
android:text="Button Text"
android:drawableStart="@drawable/picture1"
android:drawableLeft="@drawable/picture1"
android:background="@drawable/abc_ab_share_pack_mtrl_alpha"/>
Hope this helps! Let me know if you have any further questions.