Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

how to set layout width of a button from code behind in Android Xmarine in c#?

soumenhaldersoumenhalder Member ✭✭✭
edited September 2018 in Xamarin.Android

I am working with a android button in xmarine android c#project.

android:layout_marginLeft="35dp"   />     

Here I want to set this android:layout_width="120dp" and android:layout_marginLeft="35dp" from code behind.

I got the button control from code behind by

Button btn1 = FindViewById<Button>(Resource.Id.btn1);

but unable to set width and marginLeft

how to do this?

Best Answer


Sign In or Register to comment.