0
그래서 내가 활동있는 ScrollView
/* We will show the data we read in a TextView. */
TextView tv = new TextView(this);
/* Will be filled and displayed later. */
String myString = null;
try {
/* Define the URL we want to load data from. */
//http://androidtest.host.org/roster.txt
URL myURL = new URL(
"http://androidtest.host.org/roster.txt");
/* Open a connection to that URL. */
URLConnection ucon = myURL.openConnection();
/* Define InputStreams to read
* from the URLConnection. */
InputStream is = ucon.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is);
/* Read bytes to the Buffer until
* there is nothing more to read(-1). */
ByteArrayBuffer baf = new ByteArrayBuffer(50);
int current = 0;
while((current = bis.read()) != -1){
baf.append((byte)current);
}
/* Convert the Bytes read to a String. */
myString = new String(baf.toByteArray());
} catch (Exception e) {
/* On any Error we want to display it. */
myString = e.getMessage();
}
/* Show the String on the GUI. */
tv.setText(myString);
this.setContentView(tv);
}
}
에서이 코드를 내 응용 프로그램에서이 일족의 명단을 보여주기 위해 노력하고 있어요하지만 내가 만든 레이아웃을 사용하지 않기 때문에 내가 어떻게 스크롤 활성화합니까 : 명단을 .xml? 그래서 목록에서 더 아래에있는 이름으로 스크롤 할 수 있도록 어떻게 작동합니까?
제 코드를 수정 해주십시오. 내가 게시 한 코드를 사용하는 방법을 실제로 파악할 수 없다 :) 그리고 배경색을 설정하는 방법이 있습니까? – SnoX
코드에 스크롤 뷰를 적용했습니다. 그런 다음 scrollview에 textview를 추가하고 scrollview를 contentview로 설정했습니다. Jus는이 코드를 시험해 봅니다. 대부분 작동 할 것입니다. –
코드를 어디에 넣을 지 말해 주시면 이해가되지 않습니다. 그리고 당신은 bgcolor를 설정할 수 있습니까? – SnoX