Reputation: 117
I want to make this kind of button in xamarin android app:
How to achieve that?
Thanks in advance
Upvotes: 0
Views: 381
Reputation: 1291
You can Simply use android:background="@android:color/holo_red_dark"
in Button of your Lay out xml.
Or
If you want use an image for Button background.
The you can use android:background="@drawable/your_btn_image"
.
in this case you just want to copy the image in to the drawable folder of your project.
Upvotes: 1
Reputation: 224
LinearLayout
can be used to achieve a similar result
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="50dp"
app:srcCompat="@drawable/ic_cross_square"
android:layout_height="50dp" />
<TextView
android:layout_width="match_parent"
android:background="@android:color/holo_red_dark"
android:textColor="@color/white"
android:gravity="center"
android:textSize="25sp"
android:text="@string/myText"
android:layout_height="50dp" />
</LinearLayout>
Upvotes: 1
Reputation: 69754
Try this
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="10dp"
android:background="@drawable/test"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#e3ff0000"
android:drawableLeft="@drawable/ic_message"
android:padding="10dp" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#95ff0000"
android:text="Nilesh" />
</LinearLayout>
Upvotes: 1