J'ai un edittext, et quand je clique sur ce edittext, un clavier virtuel apparaît, je veux obtenir la position exacte (coordonnées) que j'ai touchée dans le clavier (getX, getY).
Voici le fichier main.XML:
Et voici keyboard.xml:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:id="@+id/xMLayout" android:background="#000000" android:layout_height="fill_parent" android:focusable="true" android:orientation="vertical"> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:id="@+id/xsubLayout" android:keepScreenOn="true" android:orientation="vertical" android:layout_height="fill_parent"> <EditText android:id="@+id/xEt" android:layout_width="fill_parent" android:focusableInTouchMode="true" android:layout_height="410sp" /> </RelativeLayout> <RelativeLayout xmlns:android="http://schemas.andr`enter code here`oid.com/apk/res/android" android:layout_width="match_parent" android:id="@+id/xK1" android:layout_height="wrap_content" android:orientation="vertical" android:visibility="gone"> <include android:id="@+id/xKeyBoard" layout="@layout/keyboard"></include> </RelativeLayout> </RelativeLayout>
Des idées SVP.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/hebrwKeyboardView" android:layout_width="fill_parent" android:layout_alignParentBottom="true" android:layout_below="@+id/xsubLayout" android:orientation="vertical" android:background="#252625" android:visibility="visible" android:layout_height="180sp"> <TableLayout android:layout_width="fill_parent" android:layout_height="200sp" android:orientation="vertical" android:clipChildren="true" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:id="@+id/xclavier"> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="200sp" android:padding="0sp"> <TableRow android:layout_width="fill_parent" ....> <TableRow android:layout_width="fill_parent" ....> <TableRow android:layout_width="fill_parent" ....> <TableRow android:layout_width="fill_parent" ....> </TableLayout> </TableLayout> </RelativeLayout>
Merci.
Partager