짐작할 수있는 기본보기 또는 위젯은 없습니다.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/llMain"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</LinearLayout>
활동
:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//Get your main layout from the XML
LinearLayout llMain = (LinearLayout) findViewById(R.id.llMain);
ArrayList<String> alItems = new ArrayList<String>();
//Put some example data
alItems.add("Text1");
alItems.add("Text2");
alItems.add("Text3");
for(int i=0; i<alItems.size(); i++){
//We create a Layout for every item
LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.HORIZONTAL);
//A TextView to put the order (ie: 1.)
TextView tv1 = new TextView(this);
tv1.setText(i+1 + ". ");
ll.addView(tv1, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 0));
//TextView to put the value from the ArrayList
TextView tv2 = new TextView(this);
tv2.setText(alItems.get(i));
ll.addView(tv2, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1));
//Add this layout to the main layout of the XML
llMain.addView(ll, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, 0));
}
}
출처
2010-04-06 15:48:30
YaW
덕분에, 웹보기가 흥미 보이는 문제가 당신의 ListView와 시도하거나 프로그래밍 방식으로 의견을 수행 할 수
는 XML (그러나 이것은 조금 더러운입니다) (내가 말할 수있는 한) 표시 할 목록이 매번 다른 경우가 될 것입니다. 검색 결과 표시 인터페이스입니다. 그래도 WebView에 대해 알아두면 좋을 것입니다. – user297403