Commit 62ab64e2 authored by Nastuzzi Samy's avatar Nastuzzi Samy
Browse files

GridLayout

parent bef3688c
......@@ -25,18 +25,25 @@ public class ArticleGroupFragment implements TabHost.TabContentFactory {
private LayoutInflater layoutInflater;
private View view;
private ScrollView scrollView;
private GridLayout gridView;
private GridLayout gridLayout;
private int nbrColumns;
public ArticleGroupFragment(final Activity activity, final JsonNode articleList) throws Exception {
this.layoutInflater = LayoutInflater.from(activity);
this.view = this.layoutInflater.inflate(R.layout.fragment_article_group, null);
this.gridView = this.view.findViewById(R.id.grid_articles);
this.gridLayout = this.view.findViewById(R.id.grid_articles);
setGridLayout(3);
createGroups(activity, articleList);
}
createArticles(activity, articleList);
public void setGridLayout(final int nbrColumns) {
this.nbrColumns = nbrColumns;
this.gridLayout.setColumnCount(nbrColumns);
}
public void createArticles(final Activity activity, final JsonNode articleList) throws Exception {
public void createGroups(final Activity activity, final JsonNode articleList) throws Exception {
LinearLayout linearLayout = new LinearLayout(activity);
linearLayout.setOrientation(LinearLayout.VERTICAL);
......@@ -47,10 +54,9 @@ public class ArticleGroupFragment implements TabHost.TabContentFactory {
if (!article.get("active").booleanValue())
continue;
linearLayout.addView(new ArticleFragment(activity, article).getView());
this.gridLayout.addView(new ArticleFragment(activity, article).getView());
}
this.gridView.addView(linearLayout);
}
@Override
......
......@@ -3,6 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_rowWeight="1"
android:orientation="vertical"
android:rowCount="2">
......@@ -18,8 +19,9 @@
</RelativeLayout>
<TextView
android:layout_rowWeight="1"
android:id="@+id/text_article"
android:layout_rowWeight="1"
android:gravity="center_horizontal"
android:text="@string/article" />
</GridLayout>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment