当前位置:首页 » 安卓系统 » android文本框边框

android文本框边框

发布时间: 2022-08-19 04:38:51

㈠ android4.2开发怎样让文本框有边框

方法一:

比较土 ,加背景图片,透明的带边框的背景图片
设置到android:background就可以

方法二:
android:background的值是一个xml文件

yle="font-family: mceinline;">TextView的xml:

<TextView android:id="@+id/roomInfo"
android:layout_centerHorizontal="true"
android:textSize="24dip"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_alignParentRight="true"
android:textColor="@color/solid_black"
android:background="@drawable/setbar_bg"
android:layout_marginLeft="10dip"
android:layout_marginTop="5dip"
android:layout_width="300dip">
</TextView>

setbar_bg.xml 放在drawable-hdpi文件夹下面

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#00000000"/>
<stroke android:width="2dip" android:color="#ff000000" />
</shape>

㈡ android 如何让edittext控件显示边框

editText控件,边框其实是背景决定的,所以如果你的editText没有边框,可以通过以下两种方式解决:

  1. 给editText设置一个带边框的背景,可以是shape绘制一个corner和solid,也可以是用一个切好的.9图。

  2. 你应该是用的主题不对,把application的主题改成android:Theme.Light.NoTitleBar,editText的样式应该是有边框的那种了。

㈢ 怎么给android 设置边框

边框主要是使用shape文件,可以定制左右上下的边框,如果想要隐藏某部分,设置我透明即可。

㈣ 怎么给android 设置边框

Android是一种基于Linux的自由及开放源代码的操作系统,主要使用于移动设备,如智能手机和平板电脑。Android在开发过程中,很多情况下需要我们在TextView上面添加一个边框,但是TextView本身不支持边框,这里介绍几种设置边框的方法,可以供大家参考:

㈤ 如何设置textview的边框

先写drawable里面的xml文件,里面设置shape来设置文本框的特殊效果。

[java] view plain
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >

<!-- 实心 -->
<solid android:color="@android:color/white" />
<!-- 边框 -->
<stroke
android:width="0.5dp"
android:color="@android:color/black" />
<!-- 圆角 -->
<corners android:radius="3dp" />
<!-- 边距 -->
<padding
android:bottom="10dp"
android:left="10dp"
android:right="10dp"
android:top="10dp" />
<!-- 渐变 -->
<gradient
android:angle="270"
android:endColor="#FFFF782"
android:startColor="#13C7AF" />

</shape>

基本上常用的就这几种了,要达到很好的效果,你需要重新细致的改写里面的数据。

下面是要用到这个shape的LineLayout,在里面设置了3个TextView,没设置对其的方式,默认是向做靠齐的。

[java] view plain
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/tvbar"
android:text="hello" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/tvbar"
android:text="hello" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/tvbar"
android:text="hello" />

</LinearLayout>

㈥ android中有文本框吗设置为多行的EditText样子不好

貌似4.0之后就是只有底线,而之前的版本样式是都有边框的,貌似的修改底层样式

㈦ android 如何去掉edittext边框

将edittext的style设置成?android:attr/textViewStyle取消掉默认的样式,在设置background为@null接下来就是一个空空的edittext了(比如http://www.tiecou.com/)
,在两个edittext中间加一个view,设置background为灰色,宽度match_parent,高度2dip看看。

RelativeLayoutxmlns:android="

xmlns:tools="

android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/darker_gray">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@android:color/white"
android:orientation="vertical">

<EditText
style="?android:attr/textViewStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:hint="输入用户名"
android:paddingBottom="5dip"
android:paddingTop="5dip"/>

<View
android:layout_width="match_parent"
android:layout_height="1dip"
android:background="@android:color/darker_gray"/>

<EditText
style="?android:attr/textViewStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:hint="输入密码"
android:inputType="textPassword"
android:paddingBottom="5dip"
android:paddingTop="5dip"/>
</LinearLayout>
</RelativeLayout>

㈧ android中edittext控件可以添加边框吗

可以。
1、将edittext的style设置成?android:attr/textViewStyle 取消掉默认的样式,再设置background为@null
2、接下来就是一个空空的edittext了, 在两个edittext中间加一个view,设置background为灰色,宽度match_parent,高度2dip。
代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/darker_gray" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@android:color/white"
android:orientation="vertical" >

<EditText
style="?android:attr/textViewStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:hint="输入用户名"
android:paddingBottom="5dip"
android:paddingTop="5dip" />

<View
android:layout_width="match_parent"
android:layout_height="1dip"
android:background="@android:color/darker_gray" />

<EditText
style="?android:attr/textViewStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:hint="输入密码"
android:inputType="textPassword"
android:paddingBottom="5dip"
android:paddingTop="5dip" />
</LinearLayout>

</RelativeLayout>

热点内容
诺基亚密码忘了打什么电话 发布:2024-09-17 03:27:09 浏览:555
树深度优先算法 发布:2024-09-17 03:26:58 浏览:472
跳转页源码 发布:2024-09-17 03:13:05 浏览:543
html文件上传表单 发布:2024-09-17 03:08:02 浏览:785
聊天软件编程 发布:2024-09-17 03:00:07 浏览:726
linuxoracle安装路径 发布:2024-09-17 01:57:29 浏览:688
两个安卓手机照片怎么同步 发布:2024-09-17 01:51:53 浏览:207
cf编译后没有黑框跳出来 发布:2024-09-17 01:46:54 浏览:249
安卓怎么禁用应用读取列表 发布:2024-09-17 01:46:45 浏览:524
win10设密码在哪里 发布:2024-09-17 01:33:32 浏览:662