api찾아보니 addFooterView() 이메소드로 만지면 될거같은데
아 다른분이 남긴 질문봐도 명쾌한 답을 못얻었습니다 결국이것때문에 잠도 못자고 이러고 잇네영
소스입니다
ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ
public class ListTest extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.widget_listtest);
//* 데이터 원본 준비
ArrayList<String> arGeneral = new ArrayList<String>();
arGeneral.add("김유신");
arGeneral.add("이순신");
arGeneral.add("강감찬");
arGeneral.add("을지문덕");
arGeneral.add("김유신");
arGeneral.add("이순신");
arGeneral.add("강감찬");
arGeneral.add("을지문덕");
arGeneral.add("김유신");
arGeneral.add("이순신");
arGeneral.add("강감찬");
arGeneral.add("을지문덕");
//*/
/* 배열로 준비
String[] arGeneral = {"김유신", "이순신", "강감찬", "을지문덕"};
//*/
// 어댑터 준비
ArrayAdapter<String> Adapter;
Adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, arGeneral);
// 어댑터 연결
ListView list = (ListView)findViewById(R.id.list);
list.setAdapter(Adapter);
-------------------------------------------------------------------------------------------------------------------------------------
xml코드 입니다
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ListView
android:id="@+id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ
이게 원본소인데여
제가 따로 만느느 프로그램에서 안되서 이것때문에 1시간 30분동안 삽질을 결국 리스트뷰
책에 예제 나온게 쉽게 잇어서 바로 적용해보니 안됩니다 ㅠㅠ 제가 잘못알고 있는건지 흨 도와주세영
// 자바부분에 어탭터 연결부번에 이렇게 수정했습니다
LinearLayout linear = (LinearLayout)View.inflate(this, R.layout.test, null);
Button btn = (Button)linear.findViewById(R.id.Button01);
ListView list = (ListView)findViewById(R.id.list);
list.setAdapter(Adapter);
list.addFooterView(btn);
ㅡㅡㅡㅡtest.xml입니다 ㅡㅡㅡㅡㅡㅡ
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button android:text="@+id/Button01"
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></Button>
</LinearLayout>
ㅡㅡ 단순히 리니어래이아웃에 버튼만 추가했습니다.. 저 버튼을 리스트뷰 마지막부분에 출력하고 싶거든여 ;;
api보면 Call this before calling setAdapter 이렇게 되어있어서 전에 부르느거 같은데
setAdapter밑에 addFooterView을 추가하면은
오류업이 실행은 되늗네 버튼이 안나타납니다
Button btn = (Button)linear.findViewById(R.id.Button01);
View footerView = getLayoutInflater().inflate( R.layout.test, null, false);
제가 검색하다가 나온건데 ..흠 이게 제가 한방식같은데 킁
새벽 4시네 ㄷㄷ 좀 아시는분 도와주세연