2011-01-31 9 views
0

私はしばらくの間、比較的シンプルでなければならないことについて苦労してきましたが、それを動作させるようには思えません。各ListViewのデータは正しく表示されており、トラックボールを使用してonItemClickListenerを選択してアクティブ化できます。しかし、私は下にスクロールすることはできませんか、私は私ができるはずです知っているタッチで項目のいずれかを選択します。どんな助けでも大歓迎です。私のコードとxmlは次のとおりです。tabhost内のタッチリスト非表示

public class POITab extends TabActivity implements AdapterView.OnItemClickListener { 

public void onCreate(Bundle savedInstanceState) { 

    super.onCreate(savedInstanceState); 
    setContentView(R.layout.poitab); 

    ListView raillist=(ListView)findViewById(R.id.raillist); 
    Cursor mrailStationsCursor = db.type_query(KEY_RAIL); 
    setupTab(raillist, mrailStationsCursor, "Rail", R.drawable.logo); 

public void onItemClick(AdapterView<?> parent, View view, int position, long id) { 
Log.i("touched", " yes"); 
} 

public void setupTab (ListView list, Cursor cursor, String tabname, int drawable) { 
startManagingCursor(cursor); 
String[] from_all = new String[]{DbAdapter.KEY_NAME}; 
int[] to_all = new int[] {android.R.id.text1}; 
list.setAdapter(new SimpleCursorAdapter(this,android.R.layout.simple_list_item_1, cursor, from_all, to_all)); 
list.setOnItemClickListener(this); 

TabHost.TabSpec spec= getTabHost().newTabSpec(tabname); 
spec.setContent(list.getId()); 
spec.setIndicator(tabname, getResources().getDrawable(drawable)); 
getTabHost().addTab(spec); 
} 
} 

poitab.xml:

<?xml version="1.0" encoding="utf-8"?> 
<TabHost xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@android:id/tabhost" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"> 
<TabWidget android:id="@android:id/tabs" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content"/> 
<FrameLayout android:id="@android:id/tabcontent" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:paddingTop="62px"> 
<ListView android:id="@+id/raillist" 
android:choiceMode="singleChoice" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:layout_weight="1"> 
</ListView> 
</FrameLayout> 
</TabHost>` 
+0

私は、タッチを使ってスクロールして選択することができますが、エミュレータと電話機の画面の一番下にあることがわかりました。フレームレイアウトが何らかの形でListViewをオーバーライドすることができますか? –

答えて

0

を問題が何であったか、私を見つけた - 私は、レイアウトで宣言されたListViewを持っていた(上記図示していない、おそらく私がすべき使用されていなかったソース全体が含まれていて、すべてのタッチイベントがそれによって処理されていました)。つまり、ストーリーのモラルは、TabHost内で必要とするListViewだけです。それ以外の場合、問題が発生します。

+0

残念ながら、同じ問題がありますが、私のレイアウトに別のListViewがありません... –

関連する問題