Geo*_*lov 0 android scrollview textview
所以我想要做的就是能够点击我的TextView.我在ScrollView中有一个TextView,我试图这样做,所以当我点击屏幕时会发生一个事件.目前,当我点击我的TextView时,事件将会发生.然而,问题来自于:当我只有一行文本时,我必须单击该行文本才能检测到onTouch.我想扩展我的TextView以覆盖屏幕上的空白区域(我的屏幕底部有两个按钮).使用真实手势控制的问题在于,当我点击屏幕上的按钮时,它也会检测到,这样就无法单击.我一直试图解决这个问题,但由于某些原因它不起作用.这是我的代码.
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()){
case R.id.close:
finish();
break;
case R.id.flashcard:
if(tv.getText().equals(myCursor.getString(iFront))) {
tv.setText(myCursor.getString(iBack));
break;
}
tv.setText(myCursor.getString(iFront));
break;
case R.id.add_new:
Intent list = new Intent("com.example.flashcards.ADD_FLASHCARD");
startActivity(list);
break;
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ScrollView
android:id="@+id/scrollable"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight=".1"
android:gravity="center">
<TextView
android:id="@+id/flashcard"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:scrollbars="vertical"
android:textSize="20dp" />
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/add_new"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.55"
android:text="Add New" />
<Button
android:id="@+id/close"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.55"
android:text="close" />
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3173 次 |
| 最近记录: |