如何创建过一个字母textviews一个快速滚动并打印的第一个字符? [英] how to create a fast scroll over an alphabetic textviews and print the first character?
问题描述
我在main.xml中多个textviews
I have multiple textviews in main.xml
<LinearLayout...
>
<textview adndroid:tag="A">
...
till to Z.
</LinearLayout>
我需要在所有的textViews fastscroll。怎么做?需要一些帮助。
I need an fastscroll over all the textViews . How to do that? Need some help.
我要当pressing A或B..and等打印的字符。那怎么办?
I have to print the character when pressing A or B..and so on. How to do that?
a1.setOnTouchListener(newOnTouchListener(){
public boolean onTouch(View w,MotionEvent event)
{
//? WHAT TO WRITE HERE?
I NEED TO PRINT ON THE SCREEN A because I CLICK ON A TEXTVIEW.
I LIKE TO PRINT THE CHARACTER A IN A BOX (like the one from contact list android)
}
});
下面是一个例子code:<一href=\"http://www.google.ro/imgres?um=1&hl=ro&sa=N&biw=1024&bih=641&tbm=isch&tbnid=bNyiUOO2XN1w5M%3a&imgrefurl=https://motorola-enterprise.custhelp.com/app/answers/detail/a_id/48594/~/droid-x---contacts&docid=Gvzcu0ZvnDcdHM&imgurl=https://motorola-global-eng.custhelp.com/rnt/rnw/img/enduser/droidxdialercontactssearch2.jpg&w=480&h=432&ei=z7B5T_jXEsTysgbXsKjMBA&zoom=1&iact=hc&vpx=89&vpy=193&dur=908&hovh=213&hovw=237&tx=145&ty=99&sig=108508964887658012348&page=1&tbnh=116&tbnw=129&start=0&ndsp=20&ved=1t:429,r:14,s:0\"相对=nofollow>链接
Here is an example code: link
推荐答案
您可以这样做:
<ScrollView android:id="@+id/ScrollView02"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
....
>
<textview ...yourtextview >
...
</LinearLayout>
</ScrollView>
有关你问题的第二部分,我认为你必须添加的android:点击=真正的
来所有的textViews和处理与code。
For the second part of your question, I think you have to add android:clickable="true"
to all your textViews and handle that with code.
另外,你可以使用一个ListView中 setOnItemClickListener(新OnItemClickListener()
,这种方式更容易...
Otherwise, you could use a ListView with the setOnItemClickListener(new OnItemClickListener()
, in this way it's easier ...
这篇关于如何创建过一个字母textviews一个快速滚动并打印的第一个字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!