I have created a widget. I intentionally used layout_weight
so it would fit any screen size.
The widget is always spanned to 1X4.
I now look at different devices in the graphic editor and I see the weight doesn't help.
should I move to dip size?
The linear-layouts are spanned differently in relation to the background image.
My XML:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/app_widget_root"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/widget_bg_main"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="0dp" >
<RelativeLayout
android:id="#+id/layout_status_image"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal"
android:layout_weight="0.21"
>
<ImageView
android:id="#+id/image_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="#drawable/widget_icon_no_data"
android:visibility="invisible" />
<!--
Layout is necessary because the setVisibility of ProgressBar is not working
through remote views in 2.1. So wrapped by this layout
-->
<FrameLayout
android:id="#+android:id/widget_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="1dp"
android:layout_marginTop="1dp" >
<ProgressBar
style="?android:attr/progressBarStyle"
android:layout_width="39dp"
android:layout_height="39dp"
android:indeterminateOnly="true"
android:orientation="vertical" />
</FrameLayout>
</RelativeLayout> <!-- Status image layout -->
<!--
========================================================================
* Information layout - contains all the texts
========================================================================
-->
<LinearLayout
android:id="#+id/layout_information"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingLeft="20dp"
android:layout_weight="0.56"
>
<TextView
android:id="#+id/text_view_destination"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="\# Home in"
android:textColor="#color/solid_white"
android:textSize="19sp"
android:textStyle="bold"
android:layout_gravity="left"
/>
<TextView
android:id="#+id/text_view_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:textColor="#color/solid_white"
android:textSize="25sp"
android:textStyle="normal"
android:layout_gravity="left"
/>
</LinearLayout> <!-- Information layout -->
<!--
========================================================================
* Action layout - action buttons container
========================================================================
-->
<LinearLayout
android:id="#+id/layout_action"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical"
android:layout_weight="0.23"
>
<ImageView
android:id="#+id/image_action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="#drawable/widget_bt_drive_disabled" />
<TextView
android:id="#+id/text_view_action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="Drive!"
android:textColor="#color/disabled_white"
android:textSize="15sp"
android:textStyle="bold"
android:layout_gravity="center"
/>
</LinearLayout> <!-- Action layout -->
It is obvious because single layout working perfectly on a normal screen sized device doesn't mean that it'll work the same way on large/xlarge sized screens. So create a folder inside res "layout-large" or "layout-xlarge" (depending on device screen size). Copy same layout into newly created folder and then make some changes to it, so it'll fit for large/xlarge screens as per your requirement. Also you may copy images into ldpi, mdpi, hdpi and xhdpi to support multiple densities.
For more info: http://developer.android.com/guide/practices/screens_support.html
Hope this helps.
Related
Here is my layout, Why is there a white line between the status bar and the title? How do I remove this white line。
I made an album, but found white lines in the nested layout. I didn't search for relevant content on Google, so I posted a post for you to look at. Here are my code and screenshots.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#color/image_display_color">
<FrameLayout
android:id="#+id/surface_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<com.github.chrisbanes.photoview.PhotoView
android:id="#+id/big_image"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
<!-- toolbar -->
<LinearLayout
android:id="#+id/layout_top"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginTop="30dp"
android:visibility="visible"
android:background="#80000000">
<ImageView
android:id="#+id/back"
android:layout_width="48dp"
android:layout_height="48dp"
android:contentDescription="TODO"
android:paddingLeft="10dp"
android:src="#drawable/video_back" />
<TextView
android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:paddingLeft="10dp"
android:textColor="#android:color/white"
android:textSize="18sp" />
</LinearLayout>
<!-- 播放进度-->
<LinearLayout
android:background="#80000000"
android:id="#+id/layout_bottom"
android:layout_width="match_parent"
android:layout_height="50dp"
android:alpha="0.9"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="5"
android:visibility="visible">
<Button
android:id="#+id/btn_share"
android:background="#android:color/transparent"
android:layout_width="wrap_content"
android:layout_marginStart="10dp"
android:text="分享"
android:textColor="#color/white"
android:drawableTop="#drawable/ic_baseline_share_24"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content" />
<Button
android:id="#+id/btn_favaite"
android:background="#android:color/transparent"
android:layout_weight="1"
android:text="收藏"
android:textColor="#color/white"
android:drawableTop="#drawable/ic_baseline_favorite_24"
android:layout_width="wrap_content"
android:layout_marginStart="10dp"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content" />
<Button
android:id="#+id/btn_copy"
android:background="#android:color/transparent"
android:layout_weight="1"
android:textColor="#color/white"
android:text="复制"
android:drawableTop="#drawable/ic_copy_white"
android:layout_width="wrap_content"
android:layout_marginStart="10dp"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content" />
<Button
android:id="#+id/btn_delete"
android:textColor="#color/white"
android:background="#android:color/transparent"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_marginStart="10dp"
android:text="删除"
android:drawableTop="#drawable/ic_baseline_delete_24"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content" />
<Button
android:id="#+id/btn_more"
android:background="#android:color/transparent"
android:layout_weight="1"
android:textColor="#color/white"
android:layout_width="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:layout_marginStart="10dp"
android:drawableTop="#drawable/ic_baseline_more_vert_24"
android:text="更多"
android:layout_height="wrap_content" />
</LinearLayout>
</RelativeLayout>
Here is my screenshot。
image1
image2
The "line" is because your dark overlay doesn't exactly line up with the top of your content/bottom of the status bar. There's a gap where the content shows through:
You can see the photos through that gap. I'm assuming this layout is overlaid on the entire screen, and you're using layout_marginTop="30dp" to try and move it below the status bar? That's going to have problems - the size of the bar depends on the device. On stock Android (following Material Design guidelines) the status bar is 24dp. On your device, it's obviously close to 30dp - but not exactly! That's why it doesn't line up.
I think making this work perfectly is going to be difficult. If I were you, I wouldn't try to overlay the entire screen. If you use a NoActionBar theme, and add a Toolbar into your layout instead, then you can add your overlay in the same layout. You can cover the Toolbar if you like, and the top of the Activity/Fragment will be below the status bar.
But it looks like you're making some kind of overlay over other apps - in that case, have a look at this thread for some ideas about getting the current device's status bar height (if any): Height of status bar in Android
I am unable to see anything (the textviews) after building the app.
Only the background image is showing up and nothing else.Tried everything but still the texts doesn't show up.
Under the scrollview i make a linear layout and under that there are several other textviews.But none of them are actually showing up when i am building the app.
How can i make everything under the scrollview visible?
Here's my code:
`
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/blck"
android:weightSum="1"
tools:context="com.gnulinuxusersgroup.nitdgp.glug.faqs"
app:layout_collapseParallaxMultiplier="1.0">
<!-- TODO: Update blank fragment layout -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="75dp"
android:id="#+id/F"
tools:text="#string/faq"
tools:textColor="#ffffff"
tools:textSize="100px"
android:textAppearance="#style/TextAppearance.AppCompat"
android:layout_weight="0.02" />
<TextView
android:layout_width="match_parent"
android:layout_height="130px"
tools:text="#string/hwr"
tools:textColor="#fff"
tools:textSize="40px"
tools:textStyle="bold"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="300px"
tools:text="### `string/hwr2"
tools:textColor="#fff"
tools:textSize="40px"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="130px"
tools:text="#string/foss"
tools:textColor="#fff"
tools:textSize="40px"
tools:textStyle="bold"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="269dp"
tools:text="#string/foss2"
tools:textColor="#fff"
tools:textSize="40px" />
<TextView
android:layout_width="match_parent"
android:layout_height="130px"
tools:text="#string/work1"
tools:textColor="#fff"
tools:textSize="40px"
tools:textStyle="bold"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="300px"
tools:text="#string/work2"
tools:textColor="#fff"
tools:textSize="40px"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="130px"
tools:text="#string/free"
tools:textColor="#fff"
tools:textSize="40px"
tools:textStyle="bold"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="300px"
tools:text="#string/free2"
tools:textColor="#fff"
tools:textSize="40px"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="46dp"
tools:text="#string/git"
tools:textColor="#fff"
tools:textSize="40px"
tools:textStyle="bold"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="300px"
tools:text="#string/git2"
tools:textColor="#fff"
tools:textSize="40px"
/>
<TextView
android:layout_width="394dp"
android:layout_height="50dp"
tools:text="#string/gsoc"
tools:textColor="#fff"
tools:textSize="40px"
tools:textStyle="bold"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="700px"
tools:text="#string/gsoc2"
tools:textColor="#fff"
tools:textSize="40px"
/>
</LinearLayout>
</ScrollView>
`
Replace your various tools: attributes with android: attributes.
The tools namespace is used only by the Android Studio design preview window. This allows you to do things like specify placeholder text so that you can see what it would look like... without specifyiing actual user-visible text that might incorrectly appear in the real world.
Take this TextView:
<TextView
android:layout_width="match_parent"
android:layout_height="130px"
tools:text="#string/hwr"
tools:textColor="#fff"
tools:textSize="40px"
tools:textStyle="bold"
/>
Because all of the last four attributes use the tools namespace, they will not actually have any effect when you run the app. This is the same as having written this (as far as your running app is concerned):
<TextView
android:layout_width="match_parent"
android:layout_height="130px"
/>
For now, just replace all the tools namespaces with android:
<TextView
android:layout_width="match_parent"
android:layout_height="130px"
android:text="#string/hwr"
android:textColor="#fff"
android:textSize="40px"
android:textStyle="bold"
/>
Adding to the Ben P's answer, the possible culprits are:
Check your background color as you are setting text color to white make sure they have contrast.
As the orientation of LinearLayout is Vertical and you are using weight sum its better to have layout_height="0dp" in case of horizontal orientation have width as 0dp.
If you are specifying weightsum make sure the layout_weight adds up to the value, you can omit the weightsum by which system calculates percentages automatically by considering individual weights of widgets in group.
Also as the widgets are textview you can't see much difference in vertical orientation so i have changed the below xml orientation to horizontal so that while running on device or in the layout preview window you can see the weight difference clearly.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/F"
android:text="hello1"
android:textSize="60px"
android:textAppearance="#style/TextAppearance.AppCompat"
android:layout_weight="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hello1r"
android:textSize="40px"
android:textStyle="bold"
android:layout_weight="4"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hello3"
android:layout_weight="1"
android:textSize="40px"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hello4"
android:layout_weight="2"
android:textSize="40px"
android:textStyle="bold"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="hello5"
android:textSize="40px" />
I'm having an awkward error, and do not have any clue about what's the cause.
I'm working on a maintenance of an android map application, it was using GoogleMap API, but now I've changed it to MapLink API. One of the view is this one:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/white"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1">
<EditText
android:id="#+id/searchText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_marginTop="3dip"
android:ems="10"
android:hint="Busca"
android:maxLines="1"
android:layout_weight="0.85" />
<Button
android:id="#+id/searchBtn"
android:layout_width="32dp"
android:layout_height="32dp"
android:background="#drawable/magnifier13"
android:onClick="search" />
</LinearLayout>
<View
android:id="#+id/separator1"
android:layout_width="fill_parent"
android:layout_height="2dip"
android:background="#color/red" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1" >
<br.com.maplink.map.MapTemplate
android:id="#+id/mapview"
android:layout_width="match_parent"
android:layout_height="match_parent">
</br.com.maplink.map.MapTemplate>
<ImageView
android:id="#+id/drag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/androidpin64"
android:visibility="gone" />
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="100dip"
android:orientation="vertical" >
<View
android:id="#+id/separator2"
android:layout_width="fill_parent"
android:layout_height="2dip"
android:background="#color/red" />
<EditText
android:id="#+id/txtEtiqueta"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:layout_marginTop="3dip"
android:ems="10"
android:hint="Etiqueta"
android:maxLines="1" >
<requestFocus />
</EditText>
<Button
android:onClick="create"
android:id="#+id/btnCadastrarPOI"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:paddingRight="10dip"
android:text="Concluído" />
</LinearLayout>
When I click on the top textbox the keyboard just appear and when it's dismissed everything is normal, but when I click on the bottom textbox, the keyboard scroll the content page up and the content above the map goes off the view, when the keyboard is dismissed the content page scrolls back to it's original, but the content above the map is covered by a black frame, if I rotate the device or try to click on the top text box the black frame disappear.
I've already tried to recreate the view on other file but it keep this problem, I've tried the same thing on other project and everything is working fine.
Also, this problem only happen on landscape orientation;
Thanks.
i want to create an ap that it has a list in the bottom of the page and when i scroll over the screen down, the top of screen disappear and show only the list of elements (and when i scroll up again it show me the top of page again)- the same as in the facebook app..
i tried to implement it and this is my xml with a listview and scrollview, however it doesnt work as expected..
when i scroll page the page stay as is, and only when i scroll the list view , the list view goes down, however the top of the page remain and the list view remain in the same size)
how can i do the same list as in the facebook android app?
thanks alot
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffffff" >
<!-- Header Starts -->
<LinearLayout
android:id="#+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#layout/header_gradient"
android:paddingBottom="5dip"
android:paddingTop="5dip" >
<!-- Logo Start -->
<!-- Logo Ends -->
<com.facebook.widget.ProfilePictureView
android:id="#+id/profilePictureView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="18dp"
android:layout_weight="1" >
</com.facebook.widget.ProfilePictureView>
<TextView
android:id="#+id/profileNameText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="80dp"
android:layout_weight="1"
android:ems="10"
android:inputType="textPersonName" />
</LinearLayout>
<!-- Header Ends -->
<ImageView
android:id="#+id/freinds"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:layout_below="#+id/detailsText"
android:layout_marginRight="40dp"
android:layout_marginTop="17dp"
android:src="#drawable/logo" />
<ImageView
android:id="#+id/LikeImage"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignTop="#+id/freinds"
android:layout_marginRight="27dp"
android:layout_toLeftOf="#+id/freinds"
android:src="#drawable/logo" />
<TextView
android:id="#+id/detailsText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/header"
android:layout_marginTop="16dp"
android:layout_toLeftOf="#+id/freinds"
android:ems="10"
android:inputType="textMultiLine" >
<requestFocus />
</TextView>
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/freinds" >
<Button
android:id="#+id/registerTwitter"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="Sale" />
<Button
android:id="#+id/registerFB"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="Deliver" />
<Button
android:id="#+id/clearCredentials"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="Group" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#+id/linearLayout1"
android:orientation="vertical" >
<EditText android:id="#+id/EditText01"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:hint="Search">
</EditText>
<ListView android:id="#+id/ListView01"
android:layout_height="wrap_content"
android:layout_width="fill_parent">
</ListView>
</LinearLayout>
</RelativeLayout>
</ScrollView>
I think what you want is a little more complex than just xml layout, but maybe I miss understood, try playing a little with the scroll view events.
you want to display the top of page instantly, when user scroll up, so you need to register to the onscroll event of the scroll view, and check for the scroll direction, to display the top section of the page. is that more clear?
I have a HorizontalScrollView with some buttons, I am trying to stretch these buttons to fill the whole width of the HorizontalScrollView so that they can appear organized and equally spaced between each others. Here is the Image which I have.
I want these 4 buttons to be stretched over the whole width! here is my code
<HorizontalScrollView
android:id="#+id/items_HorizontalBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/vf"
android:background="#80000000"
android:fillViewport="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<Button
android:layout_width="90dp"
android:layout_height="fill_parent"
android:layout_margin="5dp"
android:background="#android:color/transparent"
android:drawableTop="#drawable/rss"
android:text="Light"
android:textColor="#color/green_color"
android:textSize="20sp" />
<Button
android:layout_width="90dp"
android:layout_height="fill_parent"
android:layout_margin="5dp"
android:background="#android:color/transparent"
android:drawableTop="#drawable/rss"
android:text="Door"
android:textColor="#color/green_color"
android:textSize="20sp" />
<Button
android:layout_width="90dp"
android:layout_height="fill_parent"
android:layout_margin="5dp"
android:background="#android:color/transparent"
android:drawableTop="#drawable/rss"
android:text="Alarms"
android:textColor="#color/green_color"
android:textSize="20sp" />
<Button
android:layout_width="90dp"
android:layout_height="fill_parent"
android:layout_margin="5dp"
android:background="#android:color/transparent"
android:drawableTop="#drawable/rss"
android:text="Window"
android:textColor="#color/green_color"
android:textSize="20sp" />
</LinearLayout>
</HorizontalScrollView>
Instead of messing with LinearLayout you should follow the correct solution that is setting the HorizontalScrollView (or Vertical) to FillViewPort.
XML:
android:fillViewport="true"
Programmatically:
hsv.setFillViewport(true);
For equal distributions, set the weightSum value of the parent, and assign layout_weight to its children.
For 4 equal sized buttons, add android:weightSum="1" to the LinearLayout. For each of the buttons set android:layout_width="0dp", then add android:layout_weight="0.25".
This is what occurs in the code but depending on the View, the "Distribute Weights Evenly" button in the Eclipse GUI can also help.
However, HorizontalScrollView can only host one direct child, I wonder about the structure of this layout...
try making the container a horizontal scroll view. After that add in a table layout, and in each row of the table add in a horizontal linear layer. what will now happen instead, is that the scroll view will be stretched to fit the button size you set, and should scroll w/o you having to program a thing, and you should have effectively created a grid.
try something similar to this:
<?xml version="1.0" encoding="utf-8"?>
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/sc1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="horizontal" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="#+id/button1"
android:layout_width="180dp"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="#+id/button2"
android:layout_width="180dp"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="#+id/button3"
android:layout_width="230dp"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="#+id/button4"
android:layout_width="233dp"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</TableRow>
<TableRow
android:id="#+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</TableRow>
</TableLayout>
Also perhaps you could wrap the horizontal scroll view in a vertical scroll view then you can scroll up/down, left/right and do as you need.