Search code examples
xamarinxamarin.android

How to set the height for button only for tablet in axml?


How to set the height for button only for tablet in axml?

<Button     android:id="@+id/logout_button"
            android:background="@drawable/bordered_button"
            android:textColor="@color/primary"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="10"
            android:textSize="18sp"
            android:layout_marginLeft="0.0dp"
            android:layout_marginTop="0.0dp" />

Solution

  • Since you seem to be using native Xamarin.Android I would suggest the best way of making this work would be checking the native Android documents for supporting screen sizes.

    When you do you will multiple solutions based on your use case :

    • Using ConstraintLayout
    • Create alternative layouts and so on

    Feel free to get back to me in case you have queries.