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 6197361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:48:24+00:00 2026-05-24T03:48:24+00:00

I have a tablelayout in Android like this: 1) Row == IMAGEVIEW | TEXTVIEW

  • 0

I have a tablelayout in Android like this:

1) Row == IMAGEVIEW | TEXTVIEW
2) Row == IMAGEVIEW | SPINNER

Now what I need to do is switch the TEXTVIEW/SPINNER. The one from row 2 goes to row 1 and the one from 1 goes to 2.

Would be awesome to have a little animation also. I’ve seen Viewswitcher and Viewflipper but This doesn’t seem to be what I am looking for. Anyone got a good idea how to get this to work?

My layout (a piece of it) looks like this:

<TableRow>
        <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/left_layout_controlls"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">
                <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
                    android:layout_width="wrap_content" 
                    android:stretchColumns="*"
                    android:id="@+id/top_controlls"
                    android:layout_height="wrap_content">

                    <TableRow>
                        <ImageView
                           android:id="@+id/fromCountry_img" 
                           android:src="@drawable/tc_rt_from"
                           android:layout_width="wrap_content"
                           android:layout_gravity="center_horizontal"
                           android:layout_height="fill_parent"
                           />

                        <TextView
                            android:id="@+id/fromCountry"
                            android:layout_marginTop="2px"
                            android:layout_marginLeft="2px"
                            android:background="@drawable/round_edges_main_controll"

                            android:layout_marginRight="2px"
                            android:layout_height="38px"
                            android:layout_width="160dip"/>
                        </TableRow>
                     </TableLayout>

                    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
                        android:layout_width="wrap_content" 
                        android:stretchColumns="*"
                        android:layout_below="@id/top_controlls"
                        android:layout_height="wrap_content">
                        <TableRow>
                             <ImageView 
                               android:src="@drawable/tc_rt_to"
                               android:layout_width="wrap_content"
                               android:layout_gravity="center_horizontal"
                               android:layout_height="fill_parent"
                               android:layout_below="@id/fromCountry_img"
                               />

                            <Spinner 
                                android:id="@+id/toCountry"
                                android:layout_height="wrap_content"
                                android:layout_marginTop="2px"
                                android:layout_marginBottom="2px"
                                android:layout_marginRight="2px"
                                android:layout_width="160dip"
                                android:layout_weight="1"
                                android:drawSelectorOnTop="true"/>
                        </TableRow>
                    </TableLayout>

Update:

I’ve tried to switch the controlls like this, and the animation works, but when the animation ends, the controlls will jump back into their old position.

Any idea why?

LinearLayout layout1 = ((LinearLayout) DataHolder.activityHolder.findViewById(R.id.top_controll));
            LinearLayout layout2 = ((LinearLayout) DataHolder.activityHolder.findViewById(R.id.bottom_controll));
DataHolder.activityHolder.findViewById(R.id.toCountry));
TranslateAnimation a = new TranslateAnimation(
Animation.ABSOLUTE,0,Animation.ABSOLUTE,0,
Animation.ABSOLUTE,0,Animation.ABSOLUTE, 40);
a.setDuration(1200);

TranslateAnimation b = new TranslateAnimation(
Animation.ABSOLUTE,0,Animation.ABSOLUTE,0,
Animation.ABSOLUTE,0,Animation.ABSOLUTE, -40);
b.setDuration(1200);

layout1.startAnimation(a);
layout2.startAnimation(b);
  • 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-05-24T03:48:24+00:00Added an answer on May 24, 2026 at 3:48 am

    Simplest way to do this is to have Spinner with visibility GONE(which does not take place in the container) where you have the TextView and TextView where you have Spinner. Then just switch the visibilities. This solution is not practical one.

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

Sidebar

Related Questions

I'm using a TableLayout in Android. Right now I have one TableRow with two
In my .xml file i have this format: <LinearLayout android:layout_orientation=vertical...> <ImageView>... </ImageView> <ScrollView ...>
I have a Layout (using TableLayout, etc...) which works well. It seems like this:
I have a layout issue. What I do is this: create TableLayout in xml
I have the following layout for a dialog: <?xml version=1.0 encoding=utf-8?> <TableLayout xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/categorylist
I have a listlayout with items in it that looks like this: There is
I have an xml file like this. On vertical orietation everything is looking perfect.
I have a layout that contains a TableLayout with three rows. Each row has
I have a TableLayout that is created programmatically in an Android project. I keep
I have a TableLayout in the xml that has a row. I am adding

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.