Xamarin C#将视图宽度设置为Android屏幕的百分比

Xamarin C#将视图宽度设置为Android屏幕的百分比,第1张

概述我有这个按钮,我希望屏幕宽度的25%,和方形.我已经看到了一些制作网格的方法但是效果还不好.有人对此事有任何意见吗?还需要描述更多的背景吗?解决方法:Android.Support.Design包还提供了一个名为PercentRelativeLayout的漂亮新布局类型.您可以通过将Xamarin.Android.Support.Percent

我有这个按钮,我希望屏幕宽度的25%,和方形.我已经看到了一些制作网格的方法但是效果还不好.有人对此事有任何意见吗?
还需要描述更多的背景吗?

解决方法:

Android.Support.Design包还提供了一个名为PercentrelativeLayout的漂亮新布局类型.

您可以通过将Xamarin.Android.Support.Percent NuGet package添加到项目中来获取它.

这将使您能够将PercentrelativeLayout添加到您的布局,如:

<androID.support.percent.PercentrelativeLayout     xmlns:androID="http://schemas.androID.com/apk/res/androID"     xmlns:app="http://schemas.androID.com/apk/res-auto"     androID:layout_wIDth="match_parent"     androID:layout_height="match_parent"/>     <ImageVIEw         app:layout_wIDthPercent="50%"         app:layout_heightPercent="50%"         app:layout_margintopPercent="25%"         app:layout_marginleftPercent="25%" />     <!-- more vIEws here --></androID.support.percent.PercentrelativeLayout>

你可以找到more information about this layout in the Google API docs.

总结

以上是内存溢出为你收集整理的Xamarin C#将视图宽度设置为Android屏幕的百分比全部内容,希望文章能够帮你解决Xamarin C#将视图宽度设置为Android屏幕的百分比所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1115755.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存