Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8662623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:46:41+00:00 2026-06-12T16:46:41+00:00

I have the following layout: <GridView android:id=@+id/gridViewCalendar android:layout_width=match_parent android:layout_height=match_parent android:gravity=center android:numColumns=7 > </GridView> And

  • 0

I have the following layout:

<GridView
    android:id="@+id/gridViewCalendar"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:numColumns="7" >
</GridView>

And the following code makes simple ArrayAdapter:

private View initializeCalendarScreen(LayoutInflater inflater) {
    View layout=inflater.inflate(R.layout.calendar_layout, null);
    GridView events=(GridView)layout.findViewById(R.id.gridViewCalendar);

    ArrayAdapter<String> adapter=new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1, items);
    events.setAdapter(adapter);
    return layout;
}

It works, but text in cells isn’t on the center – it has got default align by left. How can I fix it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:46:43+00:00Added an answer on June 12, 2026 at 4:46 pm

    You should create your own layout for the items instead of using android.R.layout.simple_list_item_1
    the layout is made this way as seen on the android SKD:

    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/text1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceListItemSmall"
    android:gravity="center_vertical"
    android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
    android:paddingRight="?android:attr/listPreferredItemPaddingRight"
    android:minHeight="?android:attr/listPreferredItemHeightSmall"
    />
    

    You can simply copy that but put android:gravity=”center” or modify it to suit your needs

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following LinearLayout with a GridView in it: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=match_parent android:layout_height=match_parent
I have the following layout: <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=fill_parent android:background=@drawable/aussie_bg_big > <ImageView android:id=@+id/titleImage android:layout_width=wrap_content
This is maddening. I have the following XML layout: <FrameLayout android:layout_width=fill_parent android:layout_height=wrap_content android:background=@drawable/shadow android:focusable=true
I have the following layout. <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:orientation=vertical android:layout_width=match_parent android:layout_height=wrap_content style=@style/list_item_bottom> <TextView android:id=@+id/list_item_name android:layout_width=match_parent
I have the following layout: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=wrap_content android:orientation=horizontal> <ImageView android:id=@+id/movie_icon android:src=@drawable/star_off android:layout_height=wrap_content
i have created following layout. <TableLayout android:layout_width=fill_parent android:layout_height=wrap_content android:orientation=horizontal > <TableRow> <TextView android:layout_width=fill_parent android:layout_height=wrap_content
I have the following layout <ScrollView xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=fill_parent android:background=@android:color/white > <LinearLayout android:id=@+id/answerMainFrame android:layout_width=fill_parent
I have the following Layout which does not work: <LinearLayout android:orientation=horizontal android:layout_width=match_parent android:id=@+id/experienceLayout android:background=#ffffff
I have the following layout: <Button android:id=@+id/MyButton android:layout_width=fill_parent android:layout_height=wrap_content android:text=@string/Hello android:clickable=true android:onClick=Foo /> And
I have the following layout: <?xml version=1.0 encoding=utf-8?> <RelativeLayout android:id=@+navigate/RLayout android:layout_width=fill_parent android:layout_height=fill_parent android:background=#ABABAB xmlns:android=http://schemas.android.com/apk/res/android

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.