2012-03-06 2 views
0

내 application.it에있는 조각을 사용하고 있습니다 tab.filter.the 목록보기에 목록을 표시해야하는 별도의 XML 파일입니다 .i는보기와 함께 listview를 inflate했습니다 flipper.the 목록보기의 내용 (목록 항목) 다른 XML 파일입니다 .it 네 textviews.the textviews 값을 동적으로 설정하고 있습니다. 나는이 목적을 위해 저장소 어댑터라는 사용자 지정 어댑터를 만들었습니다.하지만 문제는 내가 수 없습니다 내 program.when 에서이 저장소 어댑터를 사용하여 values.Since 목록보기 항목을 표시하지 않습니다 사용하고 있기 때문에 listfragment 잘 확장 할 수 없습니다 별도의 파일이기 때문에 나는 내 content.given 표시해야할지 모르겠다. 아래 코드는 내 code.plz입니다.단편에 대한 목록 어댑터

public class TabStoreLocatorFragment extends Fragment implements OnClickListener { 

private Button mapSwitcher; 
private LinearLayout lastSelectedStoreButton; 
private LinearLayout noSelectedStoreSection; 
private TextView storeInfoName; 
private TextView storeInfoAddress; 
private TextView storeInfoCity; 
private RelativeLayout phoneLocationButton; 
private EditText searchStoreLocation; 
private ListView storeList; 
private ViewFlipper storeFlipper; 
private LinearLayout theLayout; 
private Store store; 
private Context context; 
private String searchStoreText; 

//private ProgressDialog findStoreProgressDialog; 
//private StoreItemizedOverlay<StoreOverlayItem> storeOverlay; 
//private List<Overlay> mapOverlays; 
//private Drawable storePin; 

@SuppressWarnings("static-access") 
public View onCreateView(LayoutInflater inflater, ViewGroup container, 
     Bundle savedInstanceState) { 
    if (container == null) { 
     // We have different layouts, and in one of them this 
     // fragment's containing frame doesn't exist. The fragment 
     // may still be created from its saved state, but there is 
     // no reason to try to create its view hierarchy because it 
     // won't be displayed. Note this is not needed -- we could 
     // just run the code below, where we would create and return 
     // the view hierarchy; it would just never be used. 
     return null; 
    } 


    context=getActivity().getApplicationContext(); 
    theLayout = (LinearLayout) inflater.inflate(
      R.layout.tab_store_locator_layout, container, false); 

    phoneLocationButton = (RelativeLayout) theLayout.findViewById(R.id.phone_location_button); 
    mapSwitcher=(Button)theLayout.findViewById(R.id.switch_state_button); 
    lastSelectedStoreButton=(LinearLayout)theLayout.findViewById(R.id.last_selected_store_button); 
    noSelectedStoreSection=(LinearLayout)theLayout.findViewById(R.id.no_selected_store); 
    storeInfoName=(TextView)theLayout.findViewById(R.id.store_name); 
    storeInfoAddress=(TextView)theLayout.findViewById(R.id.store_address); 
    storeInfoCity=(TextView)theLayout.findViewById(R.id.store_city); 
    searchStoreLocation=(EditText)theLayout.findViewById(R.id.search_store); 
    storeFlipper = (ViewFlipper)theLayout.findViewById(R.id.store_flipper); 
    storeList = (ListView)inflater.inflate(R.layout.store_list, null); 
    storeFlipper.addView(storeList); 

    store=new Store(); 
    store.setName("store1"); 
    store.setAddress("california"); 
    store.setCity("newyork"); 
    store.setZipCode("23"); 
    store.setState("california"); 

    phoneLocationButton.setOnClickListener(this); 
    mapSwitcher.setOnClickListener(this); 
    lastSelectedStoreButton.setOnClickListener(this); 
    return theLayout; 

} 


@Override 
public void onClick(View view) { 
    int id = view.getId(); 
    if (id == R.id.phone_location_button) { 

     searchStoreText=searchStoreLocation.getText().toString(); 


     @SuppressWarnings("unchecked") 
     StoreAdapter adapter = new StoreAdapter(context, R.layout.store_list_item); 

     storeList.setAdapter(adapter); 



    } 
    else if(id == R.id.switch_state_button){ 

    } 
    else{ 


    } 


} 

    } 

답변

1

사용자 지정 목록 어댑터가 작동합니다.

관련 문제