Xamarin 如何创建背景为白色、没有边框、文本下方只有一条底线的按钮

Xamarin 如何创建背景为白色、没有边框、文本下方只有一条底线的按钮,xamarin,xamarin.android,Xamarin,Xamarin.android,我一直在寻找解决办法,但找不到 我想要一个没有边框的按钮,但是有一条底线的文本(它看起来像Web中的链接按钮) 下面是按钮,我有以下属性: android:style="@style/Widget.AppCompat.Button.Borderless" android:style="?android:attr/buttonBarButtonStyle android:style="?android:attr/borderlessButtonStyle" android:style="@and

我一直在寻找解决办法,但找不到

我想要一个没有边框的按钮,但是有一条底线的文本(它看起来像Web中的链接按钮)

下面是按钮,我有以下属性:

android:style="@style/Widget.AppCompat.Button.Borderless"
android:style="?android:attr/buttonBarButtonStyle
android:style="?android:attr/borderlessButtonStyle" 
android:style="@android:style/Widget.Holo.Button.Borderless"



<Button            
android:id="@+id/ForgetPwd"            
android:layout_width="fill_parent"            
android:layout_height="wrap_content"            
android:layout_margin="10dp"            
android:background="#7AD8D3"            
android:text="Forget password"  

android:style="?android:attr/borderlessButtonStyle"    

android:textColor="#ffffff" />
android:style=“@style/Widget.AppCompat.Button.Borderless”
android:style=“?android:attr/buttonBarButtonStyle
android:style=“?android:attr/borderlessButtonStyle”
android:style=“@android:style/Widget.Holo.Button.Borderless”

欢迎您提出任何建议。

使用material design中的平面按钮可获得无边框按钮


我不认为仅仅使用xml就可以在按钮文本上添加下划线。您可以使用下面的代码实现它

Button forgetPwdButton = FindViewById<Button>(Resource.Id.ForgetPwd);
forgetPwdButton.PaintFlags = forgetPwdButton.PaintFlags | Android.Graphics.PaintFlags.UnderlineText;
Button-forgetPwdButton=findviewbyd(Resource.Id.ForgetPwd);
forgetPwdButton.PaintFlags=forgetPwdButton.PaintFlags | Android.Graphics.PaintFlags.UnderlineText;

我将此:style=“@style/Widget.AppCompat.Button.Borderless”放在按钮XML中,我将此ErrMsg:style属性不是declaredAdd Xamarin.Android.Aupport.V7.AppCompat包通过nuget和rebuild添加到项目中。我将此Android:background=“#ffffff”和take-away style=“@style/Widget.AppCompat.Button.Borderless然后用你的代码画下划线。它是这样工作的。至于样式,这个@style/widget是内置的吗?似乎Xamarin不认识它。还有为什么字母都是大写的,即使我使用了这个文本:android:text=“忘记密码”
Button forgetPwdButton = FindViewById<Button>(Resource.Id.ForgetPwd);
forgetPwdButton.PaintFlags = forgetPwdButton.PaintFlags | Android.Graphics.PaintFlags.UnderlineText;