简体   繁体   English

如何在Android中创建具有两个边的矩形形状

[英]How to create a rectangle shape with 2 sides in android

I want to show edit text box with two sides. 我想显示两个侧面的编辑文本框。 so, for that i need to create a rectangle shape with two sides. 因此,为此,我需要创建一个带有两个边的矩形。 PLease help some one. 请帮助一些。

create a drawable under drawable folder and add the belwow contents (border.xml: 在drawable文件夹下创建一个drawable并添加belwow内容(border.xml:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
   <solid android:color="@color/black" />
   <stroke android:width="1dip" android:color="@color/white"/>
</shape>

Now set the Background of the EditText to this draw able like : 现在将EditText的Background设置为该绘图,例如:

 android:background="@drawable/border"

我认为最好的方法是在PhotoShop中创建具有所需边框的9补丁...还有其他几种方法...取决于您的设计。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM