简体   繁体   中英

Table Layout in Xamarin Android

I just want to know if it's possible to click a certain data in a row from a table layout. For example I have a row with 3 columns, and I just want to click the data in the second column. Is it possible?

yes it is in a similar way like this: (If you don't have Fragments delete the view. below)

var _view = view.FindViewById(Resource.Id.list)
if (_view.ChildCount> 0){
Button _button = (Button)_view.Get(0).GetChildAt(0);
}

Because you have a lot of similar objects on a list this is the only way i think to access them, Remember that item position is relative to the current visible items on the screen and you cant access items that are not visible.

After that you define .onclick as usual.

You can Also give id on the TableRow from the axml and access it like this:

TableRow row = (TableRow)FindViewById( Resource.Id.Row1 );
row.SetOnClickListener += Something;

What are you trying to do with the TableRow?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM