① android multiautocompletetextview 怎麼設置邊框樣式
自己復寫下拉的adapter 然後在adapter中載入自己的layout 然後設置layout中TextView為顯示不全時滾動
② Android怎麼讓TextView的邊框只有左,上和底部
可以自定義邊框的,設置textview的背景就行了。有下面兩種方法:
自己弄一張.9圖,只有需求的三個邊,然後backgroud設置為該圖片;
自己寫個xml的drawable,同樣只弄需要的三個邊,同樣設置為background;
這是比較常用的兩個方式吧。
③ 怎麼讓textview呈現出一個黑色邊框
主要有三種方式可以實現:
帶有邊框的透明圖片
使用xml的shape設置
繼承TextView覆寫onDraw方法。
方法一:
帶有透明圖片的背景圖,只要設置background="#00000"就可以了。
方法二:
通過shape來設置背景圖片
首先一個textview_border.xml文件放在drawable文件夾裡面
<?xmlversion="1.0"encoding="utf-8"?>
<shapexmlns:android="http://schemas.android.com/apk/res/android"android:shape="rectangle">
<solidandroid:color="#ffffff"/>
<strokeandroid:width="1dip"android:color="#4fa5d5"/>
</shape>
為要添加邊框的TextView添加一個background
android:background="@drawable/textview_border"
方法三:
編寫一個繼承TextView類的自定義組件,並在onDraw事件方法中畫邊框。
packagecom.example.test;
importandroid.annotation.SuppressLint;
importandroid.content.Context;
importandroid.graphics.Canvas;
importandroid.graphics.Paint;
importandroid.util.AttributeSet;
importandroid.widget.TextView;
@SuppressLint("DrawAllocation")
{
publicBorderTextView(Contextcontext){
super(context);
}
publicBorderTextView(Contextcontext,AttributeSetattrs){
super(context,attrs);
}
privateintsroke_width=1;
@Override
protectedvoidonDraw(Canvascanvas){
Paintpaint=newPaint();
//將邊框設為黑色
paint.setColor(android.graphics.Color.BLACK);
//畫TextView的4個邊
canvas.drawLine(0,0,this.getWidth()-sroke_width,0,paint);
canvas.drawLine(0,0,0,this.getHeight()-sroke_width,paint);
canvas.drawLine(this.getWidth()-sroke_width,0,this.getWidth()-sroke_width,this.getHeight()-sroke_width,paint);
canvas.drawLine(0,this.getHeight()-sroke_width,this.getWidth()-sroke_width,this.getHeight()-sroke_width,paint);
super.onDraw(canvas);
}
}
④ android不用shape怎麼給textview描邊
stroke:描邊
corners:圓角
padding:間隔
Shape的使用如下,製作橢圓形邊框textview_bg.xml。
[html] view plain
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#ffffff" /> <!-- 定義填充的顏色值 -->
⑤ 給textview設置四周邊框
您好,1、設置四周邊框
<?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>
2、只設置底部邊框
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- This is the main color -->
<item>
<shape>
<solid android:color="#ffa8abad" />
</shape>
</item>
<!-- This is the line -->
<item android:bottom="2dp">
<shape>
<solid android:color="#FFFFFF" />
</shape>
</item>
</layer-list>
⑥ 怎麼給android 設置邊框
邊框主要是使用shape文件,可以定製左右上下的邊框,如果想要隱藏某部分,設置我透明即可。
⑦ android 怎麼在程代碼中給textview加下邊框xml方式我已會了!
給TextView加下邊框是不是就是在TetView下面劃一條線,如果是這樣的話方法有很多:相對布局、透明圖片、重寫onDraw都可以,我告訴你個及其取巧的方法:
1.tv.setText(Html.fromHtml("<b>附件:</b>"
+ "<a href=\"http://www.google.com\">"+這里填寫TextView的值+"</a>"));
2.tv.setMovementMethod(LinkMovementMethod.getInstance());
這是可以跳轉的,如果不要執行跳轉動作,把第2條語句注釋掉
⑧ 如何設置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>
⑨ 怎樣在textview中給文字加上邊框
可以讓TextView填滿整個父控制項,然後設置與父控制項間的邊距,再將父控制項的背景設置成黑,這樣TextView就有一個黑色邊框了。。。