當前位置:首頁 » 安卓系統 » androidtextview顯示文字

androidtextview顯示文字

發布時間: 2022-09-08 02:16:57

⑴ 請問android編程中,textview裡面放了很多文字,怎樣拖動textview讓下面的內容顯示出來。

還是我來告訴你吧!TextView本身不具備這樣的功能。你可以把你的TextView放到一個ScrollView裡面。固定ScrollView的寬(layout_width)和高(layout_height);把TextView的layout_width設為fill_parent,layout_height設為wrap_content.這樣就可以實現相應的效果了。希望能幫到你!

⑵ android textview單行顯示 並且得到該行的文字顯示的數量

TextView單行顯示:

android:singleLine ="true"

android:lines="1"

拿到文字數量:
textView.getTextSize(); (這個試一下,不確定)

⑶ 編程。 安卓編程,點擊按鈕textview顯示文本文字,代碼怎麼寫

這太簡單了,在activity中聲明一個
Button ib_01;
Textview tv_01;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ib_01 = (Button)this.findViewById(R.id.這里寫你按鈕的ID);
tv_01 = (Textview)this.findViewById(R.id.這里寫你textview的ID);
ib_01.setOnClickListener(new OnClickListener(){

public void onClick(View v) {
tv_01.settext("這里寫你想顯示在textview上的字元串");
}
})
如果樓主還是不明白可以找我QQ:959699751

⑷ android中textview顯示文字比如: 標題:XXXX 後面的XXXX怎麼獲取

TextView是最常用的組件之一用於顯示文本

像這種需求通常是兩個TextView組成的解決方案

  1. 用兩個TextView 一個作為標題,一個作為動態內容

  2. 還是用一個TexeView 直接getText().toString() 得到文本再調用String的api split(":") 拆分,即通過:進行拆分

通常在android中都是用兩個TextVew來處理的,前面一個TextVew作為標題,是固定不變的,後面一個TextVew作為變數,動態顯示內容


獲取textView文本的api :

String txt = textView.getText().toString();

⑸ android TextView顯示特殊字元

android 的TextView控制項如何顯示特殊字元?如果直接將特殊字元寫入TextView是會報錯的,需要對特殊字元進行ASCII轉換。

以下是特殊字元的ASCII碼對照表。

 <TextView  android:layout_width="wrap_content"

    android:layout_height="wrap_content"

    android:text="<用戶協議>"

    />

記住ASCII碼值的後面一定要帶上;號,否則會報錯!

⑹ android 怎樣在程序中設置TextView中顯示的值

具體操作如下:

button

bt

=(button)findviewbyid(r.id.button1);

textview

tx=(textview)findviewbyid(r.id.textview1);

tx.settext(bt.gettext());

gettext()就是獲取按鈕上的文字,在textview中顯示出來。

(6)androidtextview顯示文字擴展閱讀:

向用戶顯示文本,並可選擇允許他們編輯文本。TextView是一個完整的文本編輯器,但是基類為不允許編輯;其子類EditText允許文本編輯。

允許用戶復制部分或全部內容,將其粘貼到別的地方,設置XML屬性Android:textisselectable :「真」 或設置相關方法 settextisselectable 為「真」。textisselectable flag 允許用戶在TextView選擇手勢,從而觸發系統內置的復制/粘貼控制項。

⑺ 如何在 Android 上的 TextView 上顯示阿拉伯語文本

import android.content.Context;
import android.graphics.Typeface;
public final class Farsi {
public static boolean isFarsiConversionNeeded = true;
private final static String szLamAndAlef = Character
.toString((char) 0xfedf)
+ Character.toString((char) 0xfe8e); // Lam + Alef
private final static String szLamStickAndAlef = Character
.toString((char) 0xfee0)
+ Character.toString((char) 0xfe8e); // Lam (Sticky !!!)+
// Alef
private final static String szLa = Character.toString((char) 0xfefb); // La
private final static String szLaStick = Character.toString((char) 0xfefc); // La
// (Sticky!!!)
private final static String szLamAndAlefWoosim = Character
.toString((char) 0xe1)
+ Character.toString((char) 0xbb); // Lam + Alef

private final static String szLamStickAndAlefWoosim = Character
.toString((char) 0x90)
+ Character.toString((char) 0xbb); // Lam (Sticky !!!)+
// Alef

private final static String szLaWoosim = Character.toString((char) 0xd9); // La
private final static String szLaStickWoosim = Character
.toString((char) 0xd9); // La

// (Sticky!!!)

private static final class struc {
public char character;
public char endGlyph;
public char iniGlyph;
public char midGlyph;
public char isoGlyph;

public struc(char Character, char EndGlyph, char IniGlyph,
char MidGlyph, char IsoGlyph) {
character = Character;
endGlyph = EndGlyph;
iniGlyph = IniGlyph;
midGlyph = MidGlyph;
isoGlyph = IsoGlyph;
}
}

static struc[] arrStruc = {
new struc((char) 0x630, (char) 0xfeac, (char) 0xfeab,
(char) 0xfeac, (char) 0xfeab),
new struc((char) 0x62f, (char) 0xfeaa, (char) 0xfea9,
(char) 0xfeaa, (char) 0xfea9),
new struc((char) 0x62c, (char) 0xfe9e, (char) 0xfe9f,
(char) 0xfea0, (char) 0xfe9d),
new struc((char) 0x62d, (char) 0xfea2, (char) 0xfea3,
(char) 0xfea4, (char) 0xfea1),
new struc((char) 0x62e, (char) 0xfea6, (char) 0xfea7,
(char) 0xfea8, (char) 0xfea5),
new struc((char) 0x647, (char) 0xfeea, (char) 0xfeeb,
(char) 0xfeec, (char) 0xfee9),
new struc((char) 0x639, (char) 0xfeca, (char) 0xfecb,
(char) 0xfecc, (char) 0xfec9),
new struc((char) 0x63a, (char) 0xfece, (char) 0xfecf,
(char) 0xfed0, (char) 0xfecd),
new struc((char) 0x641, (char) 0xfed2, (char) 0xfed3,
(char) 0xfed4, (char) 0xfed1),
new struc((char) 0x642, (char) 0xfed6, (char) 0xfed7,
(char) 0xfed8, (char) 0xfed5),
new struc((char) 0x62b, (char) 0xfe9a, (char) 0xfe9b,
(char) 0xfe9c, (char) 0xfe99),
new struc((char) 0x635, (char) 0xfeba, (char) 0xfebb,
(char) 0xfebc, (char) 0xfeb9),
new struc((char) 0x636, (char) 0xfebe, (char) 0xfebf,
(char) 0xfec0, (char) 0xfebd),
new struc((char) 0x637, (char) 0xfeTypeface tf = Farsi.GetFarsiFont(this);
MyTextView.setTypeface(tf);
MyTextView.setText(Farsi.Convert("سلام"));
, (char) 0xfeMyTextView.setText(Farsi.Convert("سلام"));
,
(char) 0xfec4, (char) 0xfec1),
new struc((char) 0x643, (char) 0xfeda, (char) 0xfedb,
(char) 0xfedc, (char) 0xfed9),
new struc((char) 0x645, (char) 0xfee2, (char) 0xfee3,
(char) 0xfee4, (char) 0xfee1),
new struc((char) 0x646, (char) 0xfee6, (char) 0xfee7,
(char) 0xfee8, (char) 0xfee5),
new struc((char) 0x62a, (char) 0xfe96, (char) 0xfe97,
(char) 0xfe98, (char) 0xfe95),
new struc((char) 0x627, (char) 0xfe8e, (char) 0xfe8d,
(char) 0xfe8e, (char) 0xfe8d),
new struc((char) 0x644, (char) 0xfede, (char) 0xfedf,
(char) 0xfee0, (char) 0xfedd),
new struc((char) 0x628, (char) 0xfe90, (char) 0xfe91,
(char) 0xfe92, (char) 0xfe8f),
new struc((char) 0x64a, (char) 0xfef2, (char) 0xfef3,
(char) 0xfef4, (char) 0xfef1),
new struc((char) 0x633, (char) 0xfeb2, (char) 0xfeb3,
(char) 0xfeb4, (char) 0xfeb1),
new struc((char) 0x634, (char) 0xfeb6, (char) 0xfeb7,
(char) 0xfeb8, (char) 0xfeb5),
new struc((char) 0x638, (char) 0xfec6, (char) 0xfec7,
(char) 0xfec8, (char) 0xfec5),
new struc((char) 0x632, (char) 0xfeb0, (char) 0xfeaf,
(char) 0xfeb0, (char) 0xfeaf),
new struc((char) 0x648, (char) 0xfeee, (char) 0xfeed,
(char) 0xfeee, (char) 0xfeed),
new struc((char) 0x629, (char) 0xfe94, (char) 0xfe93,
(char) 0xfe93, (char) 0xfe93),
new struc((char) 0x649, (char) 0xfef0, (char) 0xfeef,
(char) 0xfef0, (char) 0xfeef),
new struc((char) 0x631, (char) 0xfeae, (char) 0xfead,
(char) 0xfeae, (char) 0xfead),
new struc((char) 0x624, (char) 0xfe86, (char) 0xfe85,
(char) 0xfe86, (char) 0xfe85),
new struc((char) 0x621, (char) 0xfe80, (char) 0xfe80,
(char) 0xfe80, (char) 0xfe80),
new struc((char) 0x626, (char) 0xfe8a, (char) 0xfe8b,
(char) 0xfe8c, (char) 0xfe89),
new struc((char) 0x623, (char) 0xfe84, (char) 0xfe83,
(char) 0xfe84, (char) 0xfe83),
new struc((char) 0x622, (char) 0xfe82, (char) 0xfe81,
(char) 0xfe82, (char) 0xfe81),
new struc((char) 0x625, (char) 0xfe88, (char) 0xfe87,
(char) 0xfe88, (char) 0xfe87),
new struc((char) 0x67e, (char) 0xfb57, (char) 0xfb58,
(char) 0xfb59, (char) 0xfb56), // peh
new struc((char) 0x686, (char) 0xfb7b, (char) 0xfb7c,
(char) 0xfb7d, (char) 0xfb7a), // cheh
new struc((char) 0x698, (char) 0xfb8b, (char) 0xfb8a,
(char) 0xfb8b, (char) 0xfb8a), // jeh
new struc((char) 0x6a9, (char) 0xfb8f, (char) 0xfb90,
(char) 0xfb91, (char) 0xfb8e), // keheh
new struc((char) 0x6af, (char) 0xfb93, (char) 0xfb94,
(char) 0xfb95, (char) 0xfb92), // gaf
// new struc((char) 0x6cc, (char) 0xfbfd, (char) 0xfbfe,
// (char) 0xfbff, (char) 0xfbfc), // Farsi yeh
new struc((char) 0x6cc, (char) 0xfbfd, (char) 0xfef3,
(char) 0xfef4, (char) 0xfbfc), // Arabic yeh
new struc((char) 0x6c0, (char) 0xfba5, (char) 0xfba4,
(char) 0xfba5, (char) 0xfba4) // heh with yeh
};

⑻ android中怎麼將字元串顯示在textview上

1、直接寫在布局文件里,android:text="要顯示的字元串"

2、初始化要顯示字元串的textview,然後textview.settext("要顯示的字元串");

⑼ android中在運行時如何動態設置TextView的顯示文本

// 代碼邏輯獲取字元串
String value="新內容";
TextView text = findViewByid(R.id.xxx);
text.setText(value); //設置新內容

熱點內容
伺服器電腦掛機吧 發布:2024-05-09 09:54:04 瀏覽:784
特斯拉modely買哪個配置 發布:2024-05-09 09:32:01 瀏覽:62
androidpc機 發布:2024-05-09 09:31:51 瀏覽:469
伺服器配置外網地址查詢 發布:2024-05-09 09:22:31 瀏覽:657
win系統如何組建sip伺服器 發布:2024-05-09 08:52:21 瀏覽:279
基於圖像匹配演算法 發布:2024-05-09 08:35:32 瀏覽:29
編譯安卓內核源碼 發布:2024-05-09 08:22:32 瀏覽:185
騎砍二霸主怎麼連接聯機伺服器 發布:2024-05-09 08:21:58 瀏覽:547
c語言引用參數 發布:2024-05-09 08:21:58 瀏覽:252
怎麼查看伺服器流量 發布:2024-05-09 08:12:34 瀏覽:880