Is GridLayout supported by proteus? If not then what is an alternative? - android-gridlayout

I'm trying to use GridLayout in json like this
{
"type": "GridLayout",
"android": "http://schemas.android.com/apk/res/android",
"orientation": "horizontal",
"layout_width": "match_parent",
"layout_height": "match_parent",
"columnCount": "2",
"rowCount": "2",
"children": [
{
"type": "TextView",
"layout_width": "wrap_content",
"layout_height": "wrap_content",
"layout_columnWeight": "1",
"layout_marginTop": "8dp",
"layout_marginLeft": "16dp",
"textSize": "20dp",
"textColor": "#android:color/background_dark",
"text": "244536"
},
{
"type": "TextView",
"layout_width": "wrap_content",
"layout_height": "wrap_content",
"layout_columnWeight": "1",
"layout_marginTop": "8dp",
"layout_marginLeft": "16dp",
"textSize": "20dp",
"textColor": "#android:color/background_dark",
"text": "244536"
}
]
}
I'm getting null when I am preparing a ProteusView .
If proteus does not support GridLayout, is there a way to use LinearLayout or RelativeLayout to get the same result

Proteus currently does NOT have an implementation for GridLayout; but you can implement the parser for GridLayout yourself and use it. Checkout an example of a custom parser called CircleViewParser and how to register it.
Alternatively, you can use LinearLayout with layout_weight.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="One" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="Two" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="Three" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:text="Four" />
</LinearLayout>
</LinearLayout>

Related

Top Level Element is not Compaleted

I'm really new to this and I've searched for answers but none seem relevant. When I build my android project I have an error. See at the bottom of this xml. Where do I go to find this "top level element" and why might it be incomplete?:
here code in my rowdata.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp"
android:background="#drawable/rounded_corner">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="vertical"/>
<TextView
android:id="#+id/listID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"/>
<TextView
android:id="#+id/listJudul"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Judul Buku"
android:textSize="15sp"
android:textStyle="bold"/>
<TextView
android:id="#+id/listNama"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Nama"
android:layout_marginTop="5dp"
android:textSize="14sp"/>
<TextView
android:id="#+id/listTglPinjam"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Tgl Pinjam"
android:layout_marginTop="5dp"
android:textSize="14sp"/>
<TextView
android:id="#+id/listStatus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Status"
android:layout_marginTop="5dp"
android:gravity="right"
android:textSize="13sp"/>
</LinearLayout>
</LinearLayout>

handling textview's width with screen rotation xamarin android

I have created a Xamarin.android app with listview inside a horizontalScrollView. I added [Activity(Label = "#string/app_name", Theme = "#style/AppTheme", MainLauncher = true, ConfigurationChanges = Android.Content.PM.ConfigChanges.Orientation | Android.Content.PM.ConfigChanges.ScreenSize)] to handle screen rotation. but what I realized is that my horizontalScrollView doesn't expand when screen is rotated horizontally so I added this android:fillViewport="true". it worked. but my textviews' widths remained the same. so I guessed it's because I have fixed width values for my textviews. I looked things up and finally came up with determining a weightsum for my linearlayout and weights for my textviews. this is my code:
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="fill_parent"
>
<Toolbar
android:minHeight="?android:attr/actionBarSize"
android:background="?android:attr/colorPrimary"
android:minWidth="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/toolbar1" >
<SearchView
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/searchView1" />
</Toolbar>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/customselector"
android:padding="8dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="10"
android:orientation="horizontal"
>
<TextView
android:text="Text"
android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_height="100px"
android:id="#+id/textView1"
android:gravity="center"
android:textColor="#android:color/holo_red_dark"/>
<TextView
android:text="Text"
android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_height="100px"
android:id="#+id/textView2"
android:layout_toRightOf="#id/textView1"
android:textColor="#android:color/holo_red_dark"
android:gravity="center"
android:layout_marginLeft="2dp"/>
<TextView
android:text="Text"
android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_height="100px"
android:id="#+id/textView3"
android:layout_toRightOf="#id/textView2"
android:gravity="center"
android:textColor="#android:color/holo_red_dark"
android:layout_marginLeft="2dp"/>
<TextView
android:text="Text"
android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_height="100px"
android:id="#+id/textView4"
android:layout_toRightOf="#id/textView3"
android:gravity="center"
android:layout_marginLeft="2dp"
android:textColor="#android:color/holo_red_dark"/>
<TextView
android:text="Text"
android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_height="100px"
android:id="#+id/textView5"
android:layout_toRightOf="#id/textView4"
android:gravity="center"
android:layout_marginLeft="2dp"
android:textColor="#android:color/holo_blue_dark"
/>
</LinearLayout>
</RelativeLayout>
<ListView android:id="#+id/List"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:cacheColorHint="#FFDAFF7F"
android:choiceMode="singleChoice"
/>
<TextView
android:text="Text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/textView6"
android:layout_gravity="bottom|end"/>
</LinearLayout>
</HorizontalScrollView>
I chose weightsum=10 because I want my textviews' width to be big enough. so I thought I could view the rest of my textviews by scrolling. but the scrollview stopped working. why is that? what do I do?
thanks in advance.

Android TV move focus between RecyclerViews

I am building an Android TV app with the following layout:
Both lists on the left and on the right are RecyclerViews with vertical LinearLayoutManagers, Header view is static. Navigation with D-PAD works fine within one list, but when switching from one list to another there are issues. Focus moves from, say list1's item 5 to list2' item 5. When list 2 is short has less than 5 items, it just loses focus.
I want the last focused item index saved and when the user navigates list1-list2-list1 the item with that index to gain focus again and also prevent the views from losing focus. Is there any good solution to this?
Required behaviour:
user navigates to the top of the list and presses "UP" - focus stays where it was, nothing happens.
user navigates to the bottom of the list and presses "DOWN" - focus stays where it was, nothing happens.
user navigates from list1 to list2 - the item, that previously had focus in list2, gains focus or item0 gains focus if none was focused previously.
main layout:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:id="#+id/iv_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="false"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="27dp"
android:layout_marginLeft="48dp"
android:layout_marginRight="48dp"
android:layout_marginTop="27dp"
android:orientation="horizontal"
>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:orientation="horizontal"
>
<ImageView
android:id="#+id/iv_poster"
android:layout_width="#dimen/episodes_list_item_height"
android:layout_height="#dimen/episodes_list_image_width"
/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
>
<TextView
android:id="#+id/tv_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="#+id/tv_release_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
/>
<TextView
android:id="#+id/tv_rating"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:drawableLeft="#drawable/ic_star_white_24dp"
android:drawablePadding="#dimen/view_padding_small"
/>
</FrameLayout>
<TextView
android:id="#+id/tv_description"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
</LinearLayout>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/rv_seasons_list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:focusable="false"
/>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/rv_episodes_list"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:focusable="false"
/>
</LinearLayout>
</FrameLayout>
item layout, used for both lists:
<?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="#dimen/seasons_list_item_height"
android:orientation="horizontal"
android:focusable="true"
>
<TextView
android:id="#+id/tv_title"
android:layout_width="0dp"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:layout_weight="1"
/>
<TextView
android:id="#+id/tv_episodes_count"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:ems="10"
/>
</LinearLayout>
Digging through Google's Leanback library sources answered my payers.
If you face the same trouble, just wrap your RecyclerViews with this and don't forget to set
private boolean mPersistFocusVertical = false;
if you want the focus to be persisted when searching horizontally, like in my layout.
Modify your main layout as below.
For directional navigation we can add properties like nextFocusDown, nextFocusLeft, nextFocusRight, nextFocusUp to focus relevant items as per our requirements.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:id="#+id/iv_background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="false"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="27dp"
android:layout_marginLeft="48dp"
android:layout_marginRight="48dp"
android:layout_marginTop="27dp"
android:orientation="horizontal"
>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:orientation="horizontal"
>
<ImageView
android:id="#+id/iv_poster"
android:layout_width="#dimen/episodes_list_item_height"
android:layout_height="#dimen/episodes_list_image_width"
/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
>
<TextView
android:id="#+id/tv_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="#+id/tv_release_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
/>
<TextView
android:id="#+id/tv_rating"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:drawableLeft="#drawable/ic_star_white_24dp"
android:drawablePadding="#dimen/view_padding_small"
/>
</FrameLayout>
<TextView
android:id="#+id/tv_description"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
</LinearLayout>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/rv_seasons_list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:focusable="false"
android:nextFocusDown="#+id/rv_episodes_list"
/>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/rv_episodes_list"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:focusable="false"
android:nextFocusUp="#+id/rv_seasons_list"
/>
</LinearLayout>
Hope this will solve your problem !!

Unexpected End of File, not sure why

I'm running into "Unexpected End of File" and I'm not sure why. I'm sure it's something simple but I haven't figured it out yet.
Any help or suggestions would be greatly appreciated.
Here is my code, Thank You.
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.superjoe.practicecard.FullscreenActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/goliath1"
android:scaleType="centerCrop"
android:id="#+id/imageGoliath"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, I'm Goliath."
android:textColor="#C62828"
android:textSize="36dp"
android:fontFamily="sans-serif-medium"
android:textStyle="bold"
android:id="#+id/ImGoliath"
android:layout_centerInParent="true"
android:layout_alignParentTop="true"
android:padding="12dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Don't be afraid, I don't bite..."
android:textSize="26dp"
android:fontFamily="sans-serif-medium"
android:textColor="#C62828"
android:id="#+id/afraid"
android:layout_below="#id/ImGoliath"
android:textStyle="bold|italic"
android:paddingLeft="12dp"
android:paddingBottom="18dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/unless"
android:text="Unless!"
android:textColor="#C62828"
android:textSize="52dp"
android:textStyle="bold"
android:layout_alignParentRight="true"
android:layout_below="#id/afraid"
android:padding="24dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/Youreacricket"
android:text="YOU'RE A CRICKET!"
android:textColor="#C62828"
android:layout_alignParentBottom="true"
android:textSize="42sp"
android:textStyle="bold"
android:layout_centerInParent="true"
android:paddingTop="60dp"/>
</RelativeLayout>
You need to close your FrameLayout tag under your RelativeLayout tag.
</FrameLayout>

Adding tabs dynamically in tabhost from database

I try to add tabs in tabhost dynamically from data which I extract from database. But usually I get exceptions. I want to use this tabhost in activity.
This is my code :
Main.cs
[Activity (Label = "Main",Theme = "#style/Theme.Splash")]
public class Main : Activity
{
TabHost tabHost;
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.activity_main);
tabHost = FindViewById<TabHost>(Resource.Id.tabHost1);
LocalActivityManager localActMgr = new LocalActivityManager(this, false);
localActMgr.DispatchCreate(bundle);
CSList<CategoriesArticlesConfig> categories = CategoriesArticlesConfig.List();
tabHost.Setup(localActMgr);
foreach (CategoriesArticlesConfig categorie in categories)
{
Intent i = new Intent();
i.SetFlags(ActivityFlags.NewTask);
i.PutExtra("CategorieID", categorie.CategorieArticlesConfigID);
i.SetClass(this, typeof(AfficheArticlesTab));
TabHost.TabSpec tab = tabHost.NewTabSpec("tab_"+categorie.CategorieArticlesConfigID);
tab.SetIndicator(""+categorie.Nom, Resources.GetDrawable(Android.Resource.Drawable.IcInputAdd));
tab.SetContent(i);
tabHost.AddTab(tab);
}
}
}
AfficheArticlesTab.cs
class AfficheArticlesTab : Activity
{
public AfficheArticlesTab() { }
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.activity_configuration);
GridView gridView = FindViewById<GridView>(Resource.Id.gv_item_articles_gridview_articles_tab_main_activity);
LayoutInflater layoutInflater = (LayoutInflater)GetSystemService(Context.LayoutInflaterService);
View view = layoutInflater.Inflate(Resource.Layout.gridview_articles_tab, null);
int CategorieID = Intent.Extras.GetInt("CategorieID");
CategoriesArticlesConfig categorie = CategoriesArticlesConfig.ReadFirst("CategorieArticlesID="+CategorieID);
gridView.Adapter = new ListArticleConfigAdapter(this,categorie.ArticlesConfig.ToList<ArticlesConfig>());
}
}
activity_main.axml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:minWidth="25px"
android:minHeight="25px"
android:background="#drawable/background_simple"
android:padding="5dp">
<FrameLayout
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/frameLayout1"
android:layout_margin="5dp"
android:layout_weight="0.5">
<LinearLayout
android:orientation="vertical"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/linearLayout11">
<LinearLayout
android:orientation="horizontal"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/linearLayout12"
android:layout_weight="4">
<LinearLayout
android:orientation="vertical"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/linearLayout13"
android:layout_marginTop="14.0dp"
android:layout_marginLeft="8.0dp">
<LinearLayout
android:orientation="horizontal"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/linearLayout18">
<TextView
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:id="#+id/tv_num_ticket_activity_main" />
<TextView
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:id="#+id/tv_num_caissier_activity_main"
android:layout_marginLeft="10dp" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/linearLayout14">
<LinearLayout
android:orientation="horizontal"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/linearLayout15"
android:layout_weight="0.1">
<EditText
android:inputType="numberDecimal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/ed_zone_main_activity"
android:layout_weight="0.16"
android:layout_marginTop="0.0dp" />
<TextView
android:text="#string/qte_value"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/tv_qte_value_main_activity"
android:layout_weight="0.3"
android:layout_marginRight="2.5dp"
android:layout_marginLeft="13.3dp"
android:layout_gravity="center_vertical"
android:gravity="right"
android:layout_marginTop="0.0dp"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<ListView
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/listView1"
android:layout_weight="1"
android:layout_marginTop="8.0dp" />
</LinearLayout>
</FrameLayout>
<LinearLayout
android:orientation="vertical"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:id="#+id/linearLayout17"
android:layout_weight="0.3">
<FrameLayout
android:minWidth="25px"
android:minHeight="25px"
android:id="#+id/frameLayout2"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="0.15">
<LinearLayout
android:orientation="vertical"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/linearLayout5">
<TabHost
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/tabHost1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="#+id/linearLayout19">
<TabWidget
android:id="#android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</TabHost>
</LinearLayout>
</FrameLayout>
<LinearLayout
android:orientation="horizontal"
android:minWidth="25px"
android:minHeight="25px"
android:id="#+id/linearLayout16"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="0.85">
<Button
android:text="#string/total"
android:id="#+id/bt_total_activity_main"
android:textSize="16sp"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#drawable/button_selector_rouge" />
<Button
android:text="#string/quantitee"
android:id="#+id/bt_quantitee_activity_main"
android:textSize="16sp"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#drawable/button_selector_enter" />
<Button
android:text="#string/code_barre"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:id="#+id/bt_code_barre_activity_main"
android:layout_weight="1"
android:textSize="16sp"
android:background="#drawable/button_selector_enter" />
<Button
android:text="#string/annuler"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:id="#+id/bt_annuler_activity_main"
android:layout_weight="1"
android:textSize="16sp"
android:background="#drawable/button_selector_enter" />
<Button
android:text="#string/remise"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:id="#+id/bt_remise_activity_main"
android:layout_weight="1"
android:textSize="16sp"
android:background="#drawable/button_selector_enter" />
<Button
android:text="#string/attente"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:id="#+id/bt_attente_activity_main"
android:layout_weight="1"
android:textSize="16sp"
android:background="#drawable/button_selector_enter" />
</LinearLayout>
</LinearLayout>
03-03 13:19:08.004 E/mono ( 7331): Unhandled Exception:
03-03 13:19:08.004 E/mono ( 7331): Java.Lang.NullPointerException: Exception of type 'Java.Lang.NullPointerException' was thrown.
03-03 13:19:08.004 E/mono ( 7331): at Android.Runtime.JNIEnv.CallVoidMethod (intptr,intptr,Android.Runtime.JValue[]) [0x00023] in /Users/builder/data/lanes/monodroid-lion-monodroid-4.6.6-branch/6d7480e9/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:368
03-03 13:19:08.004 E/mono ( 7331): at Android.Widget.TabHost.AddTab (Android.Widget.TabHost/TabSpec) [0x0003e] in /Users/builder/data/lanes/monodroid-lion-monodroid-4.6.6-branch/6d7480e9/source/monodroid/src/Mono.Android/platforms/android-14/src/generated/Android.Widget.TabHost.cs:762
03-03 13:19:08.004 E/mono ( 7331): at SymaMobile.Droid.Main.OnCreate (Android.OS.Bundle) [0x000e8] in f:\PFE\VS2012\SymaMobile\SymaMobile\SymaMobile.Droid\Activities\Main.cs:41
03-03 13:19:08.004 E/mono ( 7331): at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) [0x00010] in /Users/builder/data/lanes/monodroid-lion-monodroid-4.6.6-branch/6d7480e9/source/monodroid/src/Mono.Android/platforms/android-14/src/generated/Android.App.Activity.cs:1859
03-03 13:19:08.004 E/mono ( 7331): at (wrapper dynamic-m
I find it :)
Firstly, you should extends TabHost.ITabContentFactory
public class Main : Activity, TabHost.ITabContentFactory
Secondly, you should add a NewTabSpec in my tabhost.
tabHost.AddTab(tabHost.NewTabSpec("tab_" + categorie.CategorieArticlesConfigID).SetIndicator(createTabView(tabHost.Context, categorie.Nom)).SetContent(this));
And finally, you use the implemented method CreateTabContent like this:
public View CreateTabContent(string tag)
{
LayoutInflater layoutInflater = (LayoutInflater)GetSystemService(Context.LayoutInflaterService);
View view1 = layoutInflater.Inflate(Resource.Layout.gridview_articles_tab, null);
View view2 = layoutInflater.Inflate(Resource.Layout.list_item_article_configuration, null);
View view3 = layoutInflater.Inflate(Resource.Layout.tab_item, null);
GridView gridView = view1.FindViewById<GridView>(Resource.Id.gv_item_articles_gridview_articles_tab_main_activity);
CategoriesArticlesConfig categorie = CategoriesArticlesConfig.ReadFirst("CategorieArticlesConfigID=" + tabCatID[tabHost.CurrentTab]);
gridView.Adapter = new ListArticleTabAdapter(this, categorie.ArticlesConfig.ToList());
gridView.ItemClick += gridView_ItemClick;
return view1;
}
Thanks,

Resources