的Xml我LargeText查看我如何刪除單個字符,如(') android系統
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffb6c1" >
<TextView
android:id="@+id/def"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="@android:color/white"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="24dp" />
</RelativeLayout>
</ScrollView>
比如我有一句話在我File.txt
這樣的:
句= (這是一個瘋狂的一天)。
輸出在我的View LargeText 它(?)一個瘋狂的一天。
我想知道這個錯誤的答案我試圖實現StringBuilder
類,但我不知道如何使它爲Android工作。
這是我所做的所有改變,但仍然沒有成功。
package org.health.canser;
public void onCreate(Bundle savedInstanceState)
{
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
//setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
super.onCreate(savedInstanceState);
setContentView(R.layout.breast);
getFile(breastFile);
}
//my text fiel input section===============================================================================
public String loadTextFile(InputStream inputStream) throws IOException {
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
byte[] bytes = new byte[4096];
int len = 0;
while ((len = inputStream.read(bytes)) > 0)
byteStream.write(bytes, 0, len);
//return new String(byteStream.toByteArray(), "UTF8");
return new String(byteStream.toByteArray(), "UTF-8");
}
public void getFile(String fileName)
{
breast= (View) findViewById(R.id.breastDef);
AssetManager assetManager = getAssets();
InputStream inputStream = null;
try {
inputStream = assetManager.open(fileName);
String text = loadTextFile(inputStream);
Log.i("Msg","msg: " + text);
((TextView) breast).setText(text);
} catch (IOException e) {
((TextView) breast).setText("Couldn't load file");
} finally {
if (inputStream != null)
try {
inputStream.close();
} catch (IOException e) {
((TextView) breast).setText("Couldn't close file");
}
}
}
}
輸出:
01-07 15:03:53.628:I /消息(24930):風險因素:除了是女性,年齡增長是最重要的危險因素乳腺癌。潛在可改變的危險因素包括18歲以後的體重增加,超重或肥胖(絕經後乳腺癌),MHT(聯合雌激素和孕激素治療)的使用,缺乏身體活動和飲酒。預測高風險的醫學發現包括高乳房組織密度(乳腺組織相對於乳房脂肪組織的量的乳房X射線測量),高骨密度(低密度婦女骨質疏鬆症的風險增加)和活組織檢查 - 證實增生(細胞過度生長),特別是非典型增生(過度生長的細胞不正常)。胸部用於癌症治療的高劑量輻射也增加了風險。增加風險的生殖因素包括月經過去的歷史較長(月經期開始時間早或結束時間較晚),最近使用口服避孕藥,從未有孩子,並且有one?s 30歲以後的第一個孩子。
請向我們展示設置文本的代碼。 – Henry
試試這是一個瘋狂的日子 –
我想我誤解了你的問題,你的問題是你的'正在被句子替換(?),我是否正確? –