我已经开始没有这个三角形的布局了:
<relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:layout_wIDth="match_parent" androID:layout_height="48dp" androID:gravity="center_vertical" androID:paddingleft="@dimen/keyline_1" androID:paddingRight="@dimen/keyline_2"><TextVIEw androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:textcolor="@color/grey" androID:text="DESCRIPTION"/><linearLayout androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:orIEntation="horizontal" androID:layout_alignParentRight="true"> <TextVIEw androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:paddingRight="@dimen/keyline_4" androID:textcolor="@color/grey" androID:text="info"/> <TextVIEw androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:textcolor="@color/grey" androID:text="Title"/></linearLayout></relativeLayout>解决方法 使用下面的代码创建三角形形状并使其成为textvIEw背景
<?xml version="1.0" enCoding="utf-8"?><@R_318_3419@ xmlns:androID="http://schemas.androID.com/apk/res/androID" > <item> <rotate androID:fromdegrees="-45" androID:todegrees="45" androID:pivotX="0%" androID:pivotY="1%" > <shape androID:shape="rectangle" > <stroke androID:wIDth="10dp" androID:color="#00000000" /> <solID androID:color="#00ACED" /> </shape> </rotate> </item> </@R_318_3419@>
并使用下面的代码来旋转textvIEw
<TextVIEw androID:ID="@+ID/won_text" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:layout_alignParentleft="true" androID:paddingtop="20dp" androID:rotation="-45" androID:text="@string/won" androID:textAppearance="?androID:attr/textAppearanceLarge" androID:textcolor="@androID:color/white" androID:textSize="34sp" />
更多细节参见How to make custom textview in android?
总结以上是内存溢出为你收集整理的Android:如何在右上角的按钮角添加三角形全部内容,希望文章能够帮你解决Android:如何在右上角的按钮角添加三角形所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)