當前位置:首頁 » 安卓系統 » androidview線

androidview線

發布時間: 2022-06-09 13:52:48

⑴ android怎麼實現textview後面有條線

設置textview的格式 可以設置下劃線,刪除線 等等格式
textview.getPaint().setFlags(Paint. STRIKE_THRU_TEXT_FLAG |Paint.ANTI_ALIAS_FLAG);

⑵ android textview兩側貫穿線怎麼做啊

是文字上的橫線吧?類似於eclipse中一些過時方法的樣子?
如果是這樣設置就行了:tv.getPaint().setFlags(Paint. STRIKE_THRU_TEXT_FLAG );

⑶ android自定義view的參數傳遞問題

android自定義view的參數傳遞,自定義View細分一下,分為兩種
1) 自定義ViewGroup
2) 自定義View

其實ViewGroup最終還是繼承之View,當然它內部做了許多操作;繼承之ViewGroup的View我們一般稱之為容器,而今天我們不講這方面,後續有機會再講。
來看看自定義View 需要掌握的幾點,主要就是兩點
一、重寫 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {}方法。
二、重寫 protected void onDraw(Canvas canvas) {}方法
空講理論很難理解,還得用例子來說明, Android 微信6.1 tab欄圖標和字體顏色漸變的實現 的博客,裡面tab的每個item就是通過自定義View來實現的,那麼接下來就通過此例子來說明問題。
把View理解為一張白紙,而自定義View就是在這張白紙上畫上我們自己繪制的圖案,可以在繪制任何圖案,也可以在白紙的任何位置繪制,那麼問題來了,白紙哪裡來?圖案哪裡來?位置如何計算?
a)白紙好說,只要繼承之View,在onDraw(Canvas canvas)中的canvas就是平常規裁軍所說的白紙
/**
* Created by moon.zhong on 2015/2/13.
*/
public class CustomView extends View {
public CustomView(Context context) {
super(context);
}

public CustomView(Context context, AttributeSet attrs) {
super(context, attrs);

⑷ android中的View是做什麼的

View類是Android的一個超類,這個類幾乎包含了所有的屏幕類型。每一個View都有一個用於繪圖的畫布,這個畫布可以進行任意擴展。在游戲開發中葉可以自定義視圖(View),這個畫布的功能更能滿足我們在游戲開發中的需要。在Android中,任何一個View類都只需重寫onDraw 方法來實現界面顯示,自定義的視圖可以是復雜的3D實現,也可以是非常簡單的文本形式等。

⑸ android中如何利用view視圖添加一條直線

你好!
步驟1:在你創建的工程中新建一個class文件,隨便起個名字叫MyView吧,打開文件會看到:
public
class
MyView
{
}
步驟2:讓該類繼承
View類,也就是在MyView後面添幾個字母,如:
public
class
MyView
extends
View
{
}
步驟3:在上面的這個類中,寫一個方法:
public
class
MyView
extends
View
{
protected
void
onDraw(Canvas
canvas)
{
..........
}
}
步驟4:在onDrow方法中寫一條語句:
public
class
MyView
extends
View
{
protected
void
onDraw(Canvas
canvas)
{
canvas.drawLine(起點橫坐標,起點縱坐標,終點橫坐標,終點縱坐標,線的顏色);
}
}
註:看到「drawLine」了吧,這就是在畫線。
如有疑問,請追問。

java 中,android 在一個view上繪制多條線 如何點擊一條線,改變這條線的顏色。

解決這個問題的核心是你怎麼知道那條線被點擊了,首先要給View設置一個onTouchListener,然後獲取點擊的坐標,然後判斷手指在屏幕上的坐標是不是在你的線條所在的區域,這個區域的大小又你來定義。如果是,那麼你就改變paint的顏色這,然後調用invalidate()來通知VIew進行重繪。

⑺ android 用xml資源 給view設置邊界線卻不顯示是什麼原因

雙方互評後才會顯示評價內容的,他現在還沒有給你評價,評價是不會生效的哦。。如果當初您要求退換貨他不同意的話,您該投訴他的。評價顯示了的話,賣家又會找你麻煩了,也許還要給你一個差評還是要鬧到投訴的。。。哎。。為什麼淘寶那麼多無良賣家呢。我曾經也被騙過哎,可惜投訴無門啊,那個人就是騙子也沒加消保。騙了一筆錢就溜之大吉了。所以,奉勸各位買家淘寶購物一定要擦亮雙眼,看有沒有品質保證,不要貪圖便宜,否則只能吃虧。

⑻ android viewpagerindicator指示線不顯示什麼問題

使用ViewPager的setCurrentItem (int item) 方法設置其初始顯示的頁面,不是在其數據適配器中,而是在完成數據適配後設置。如viewPager.setAdapter(adapter);viewPager.setCurrentItem(3);

⑼ android中, 在一個View上畫多條線(一條線是一個實體對象),怎樣給這些線添加click事件

使用linearlayout畫這條線(即高度設置為1dp或其他,改linearlayout的背景顏色),為改linearlayout注冊onclick事件.
大致就是這樣.

⑽ 如何創建一個View的分割線

1 人工添加LinearLayout的分割線

我們可以創建一個View,這個View就是分割線,只要簡單在Button之間添加這個分割線就可以。
分割線的實現,如下:

<View android:layout_height="fill_parent" android:layout_width="1dp" android:background="#90909090" android:layout_marginBottom="5dp" android:layout_marginTop="5dp"/>So the whole layout, as pictured, becomes:
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:adjustViewBounds="true" android:orientation="horizontal"> <Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Yes" android:layout_weight="1" android:id="@+id/button1" android:textColor="#00b0e4" /> <View android:layout_height="fill_parent" android:layout_width="1px" android:background="#90909090" android:layout_marginBottom="5dp" android:layout_marginTop="5dp" android:id="@+id/separator1" /> <Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="No" android:layout_weight="1" android:id="@+id/button2" android:textColor="#00b0e4" /> <View android:layout_height="fill_parent" android:layout_width="1px" android:background="#90909090" android:layout_marginBottom="5dp" android:layout_marginTop="5dp" android:id="@+id/separator2" /> <Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Neutral" android:layout_weight="1" android:id="@+id/button3" android:textColor="#00b0e4" /> </LinearLayout>2 在LinearLayout定義divider
你可以給LinearLayout設置a view divider,這很明顯是個很好的解決方法,尤其是不知道LinearLayout下有多少個子Button。
這種必須是在API level 11 或者更高的API版本使用。
我們先定義這個分割線樣式吧:
<?把這個分割線的樣式設置給LinearLayout:
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:adjustViewBounds="true" android:divider="@drawable/separator" android:showDividers="middle" android:orientation="horizontal"> <Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Yes" android:layout_weight="1" android:id="@+id/button1" android:textColor="#00b0e4" /> <Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="No" android:layout_weight="1" android:id="@+id/button2" android:textColor="#00b0e4" /> <Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Neutral" android:layout_weight="1" android:id="@+id/button3" android:textColor="#00b0e4" /> </LinearLayout>其中最重要當然就是:
android:divider="@drawable/separator"android:showDividers="middle"

3給容器組件設置ButtonBarStyle (默認是分割線,最容易實現方法)

As danialgoodwin mentioned in the comments, adding the buttonBarStyle to the LinearLayout will show default separators. This is also for api level 11 or higher only.
The important part here, is adding this line to the LinearLayout:
<LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:dividerPadding="15dp" > <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="New Button" android:id="@+id/button1" android:layout_gravity="center_vertical" /> <!-- more buttons/views --> </LinearLayout>You can also adjust the paddings of the view separators with the 「dividerPadding」 setting.

Button使用的相同的檢舉,所以他們之間的間距也是相同的。
當然你可為分割線設置漸變色。
轉載僅供參考,版權屬於原作者。祝你愉快,滿意請採納哦

熱點內容
內置存儲卡可以拆嗎 發布:2025-05-18 04:16:35 瀏覽:336
編譯原理課時設置 發布:2025-05-18 04:13:28 瀏覽:378
linux中進入ip地址伺服器 發布:2025-05-18 04:11:21 瀏覽:612
java用什麼軟體寫 發布:2025-05-18 03:56:19 瀏覽:32
linux配置vim編譯c 發布:2025-05-18 03:55:07 瀏覽:107
砸百鬼腳本 發布:2025-05-18 03:53:34 瀏覽:944
安卓手機如何拍視頻和蘋果一樣 發布:2025-05-18 03:40:47 瀏覽:741
為什麼安卓手機連不上蘋果7熱點 發布:2025-05-18 03:40:13 瀏覽:803
網卡訪問 發布:2025-05-18 03:35:04 瀏覽:511
接收和發送伺服器地址 發布:2025-05-18 03:33:48 瀏覽:372