Hello,
I've a problem to get Gesture on the menu I generated (It's on a Layout).
I've not problem with gesture on my main activity, and i've no idea to have
it on my menu when I scroll it.
I explain what I do (on 2 class + main activity on android 2.1)
- Main activity:
public class Home : Activity
{
public static dialogCategories;
public static Context context;
public static GestureDetector _gestureScanner;
private GestureListener _gestureListener;
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView(Resource.Layout.Home);
_gestureListener = new GestureListener();
_gestureScanner = new GestureDetector(this,
_gestureListener);
InitLayoutHome();
}
public override bool OnTouchEvent( MotionEvent e )
{
return _gestureScanner.OnTouchEvent( e );
}
private void InitLayoutHome()
{
context=this;
/*
Here no problem with gesture... Click, down,
up, right, left etc.. no problem
*/
[.........]
/*
Here I print a Button to print my menu if
user click on the button
*/
button.Click+=delegate{Task.Factory.StartNew(() =>
{
//and launch with a new thread because I generated it.
RunOnUiThread(() => {Categories.Print();}
);});};
}
}
- Class GestureListener
class GestureListener : Java.Lang.Object, GestureDetector.IOnGestureListener
{
public GestureListener()
{
}
public bool OnDown( MotionEvent e )
{
Log.Debug("Gesture -DOWN-" + e.Action);
}
[.........]
}
-Class Categories (My menu)
public class Categories
{
public static void Print()
{
Home.dialogCategories = new
Dialog(Home.context, Resource.Style.CustomDialog);
//maybe i must do here a:
(TableLayout)Home.dialogCategories.FindViewById(Resource.Id.tldialogcategori
es)).OnTouchEvent(??);
/*
And here i generate my menu
<!-my Xml -->
<TableLayout
android:id="@+id/tldialogcategories" >
<TableRow>
<TextView
android:id="@+id/tvtitrecategories">
Title of menu
</TextView>
</TableRow>
<ScrollView>
<TableLayout android:id="@+id/tlcategories">
<!-- GENERATE MENU HERE IN CSHARP -->
<TableRow>
[...]
</TableRow>
<TableRow>
[...]
</TableRow>
<TableRow>
[...]
</TableRow>
<!-- / GENERATE MENU HERE IN CSHARP -->
</TableLayout>
</ScrollView>
</TableLayout>
*/
}
}
Regards
_______________________________________________
Monodroid mailing list
[email protected]
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid