Android :: Two Children For ScrollView Vertical Orientation?

Aug 10, 2010

I am trying to create a very simple application (part of my learning program), vertically oriented, with an EditText at the top that receives a URL, and two buttons side by side just below that say "Get Image" or "Get Text" depending on the URL typed in (.html vs. .png, for example). The resulting elements may be later scavanged for use in a real app. I know that ScrollView can have only one child. Conceptually, I want the rest of the screen to be a vertically oriented content region for displaying either the text (TextView) of the URL and "Get Text" was clicked or the image (ImageView) in the case where it was an image and "Get Image" was clicked. I tried to do this (pseudocode) in main.xml:

<LinearLayout> <EditText /> --where to type the URL
<Button /> --click to treat URL as text
<Button /> --click to treat URL as image
<FrameLayout> --(used to be ScrollView) <LinearLayout>
<TextView /> --content region occupied by either text
<ImageView /> --or an image (but not both)
</LinearLayout> </FrameLayout> </LinearLayout>

In order not to violate the single-child requirement. However, this doesn't work and for now I'm not finding any sample out there that clues me in to how best to accomplish this. The last complaint I got while debugging was:
Caused by: java.lang.ClassCastException: android.widget.TextView

Android :: Two Children for ScrollView Vertical Orientation?


Android :: Scrollview Vertical And Horizontal

Jan 11, 2010

I'm really tired looking for a solution for Scrollview vertical and horizontal. I read that the any view/layout implements this feature in the framework but i need something like this. I need to define a layout within other, the child layout must implement scrolling vertical/horizontal for moving. Initially implemented a code that move the layout pixel by pixel, but i think that is not the right way. I tried with ScrollView and HorizontalScrollView but any ones work like i want, because only implement vertical or horizontal scrolling.

View 3 Replies View Related

Android :: Enable Vertical Scroling Of Web View Layout With In Scrollview Tag?

Aug 2, 2010

I have problem in scrolling of webview vertically when it's scrolled along vertically,where this webview is with in scrollview tag,how can i enable the scrolling for webview and to disable the scrolling of whole layout when its on webview contained layout.

View 1 Replies View Related

Android : Way To Keep Orientation Of Droid Project Vertical?

Nov 15, 2010

Can I set a code that doesn't change the orientation of the screen of my app if I turn the phone sideways? I tried making a new main.xml file in the layout-land folder, and it just looks weird. So, the screen doesn't turn when the oreintation is changed?

View 1 Replies View Related

Android :: Layout Weight Is Inconsistent For Horizontal And Vertical Orientation

Apr 8, 2009

I have played around a bit with the xml files for creating layouts and can't explain the behaviour of layout_weight when using it in a LinearLayout that has orientation="vertical"

When creating a layout that is horizontal everything follows the documentation, that a child would get more space if it's has the highest value.

But the following code for vertical orientation, give more space to the item with lowest weight.

CODE:..........

And the question is: Is this a bug or just a feature that maybe need more documentation?

View 2 Replies View Related

Android :: ScrollView .scrollTo Not Working - Saving ScrollView Position On Rotation

Jul 16, 2010

I must be overlooking something real simple here, but i think i'm trying to do something fairly basic.. Simply retain the scrollbar position of a ScrollView on orientation change...

Here is the code for my onSaveInstanceState and onRestoreInstanceState.. sView is the container for the ScrollView layout. Within my scrollview is a linearlayout with a lot of textviews.

CODE:............

If I set a Toast with the values of sViewX and sViewY on the Restore, the values are kept and correct.

I just tried to do a sView.scrollTo(0,150); in my onCreate.. just to see if that would open the activity at 150px down, and it didn't. I think my issue has to do with the .scrollTo method.

View 1 Replies View Related

Android :: Create A ListView That's Not In A ScrollView - Or Has The ScrollView Disabled

Mar 10, 2010

I want some of the goodies in a ListView, like being able to use a ListAdapter, and item selection, etc, but I don't want the ScrollView portion of it. I want to implement that part myself, in a different way (why or how I do this isn't really the point of this question, so please don't ask "why"). Is there a way to have a ListView that's not in a ScrollView or has the scrolling disabled?

View 2 Replies View Related

Recognize Vertical Swiping And Vertical Scrolling In Gridview

Apr 14, 2014

I have a Gridview, include hundred of items (thumbnail images). I set a multi-select mode, in this mode, user just need to swipe his finger to start selecting multiple items (this case, gridview can not be scrolled). And in a normal touch, Gridview still can vertically scroll for user to see other thumbnails and continue selecting.

View 2 Replies View Related

Android :: Orientation Change - Dialog Above Activity With Fixed Orientation

May 14, 2009

I have created an activity for my game which handles all orientation changes by itself and has a fixed "portrait" layout. Actually it uses the accelerometer and is rendered using 2D canvas methods. If the level has been completed I show up a highscore dialog in which the user can enter his name. The dialog is floating above the underlying level screen which gets blurred out nicely. This generally works.

Problem is that the dialog does not get rotated if the orientation of the phone changes. So even if the keyboard is exposed the dialog is shown in portrait mode instead of landscape. I have tried to use an activity with dialog theme instead but the behavior didn't change. After several tries it seems that I have found the reason for this: Once there's an activity with fixed orientation in the activity stack then all subsequent activities keep this orientation, too. They will not react on orientation changes anymore (e.g. if the keyboard gets exposed).

After upgrading to 1.5 SDK the described behavior changed a little bit. Now at subactivities indead react on orientation changes like expected. However, the need to have an opaque background! That means that neither dialogs nor activities with dialog theme will work. Those will stick with the orientation of the underlaying activity. So my workaround is to first start a sub-activity with an opaque black background. This activity then shows my highscore dialog on top. It looks quite okay but I wonder if there's a better solution? Is it possible to show a dialog above a fixed portrait or landscape activity which automatically adapts to orientation changes?

View 3 Replies View Related

Android :: FrameLayout And Positioning Children

Jan 26, 2009

i'm in final stage of writing my custom widget (quite similar to Home's sliding panel). it works quite well except one thing: i have some problems with positioning it in FrameLayout (see 3 rightPanel* Panels in main.xml in attached eclipse project).basically i don't like the idea i'm using there: setting layout_marginTop in panelHandle children.

View 2 Replies View Related

Android :: Way To Use CheckBox As Children In ExpandableList?

Jul 13, 2009

I would like to have expandable text categories which reveal children that are checkable entries. I've used the "simple_list_item_multiple_choice" layout for the childLayout argument of SimpleExpandableListAdapter.

View 7 Replies View Related

Android :: How To Get All Children Views Of Layout?

Jul 9, 2010

Is there a way to get all the children views of a layout, from the Java code so that I can loop through them and set an attribute? Specifically, I'd like to set the "layout_width" based on the screen size. Since this "layout_width" would be the same for all the views, I'd prefer to loop through instead of calling each individual View separately by their id. The following is my main.xml:

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content">
<LinearLayout android:id="@+id/myRow1" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1"> <TextView android:text="1" android:layout_width="wrap_content"
android:layout_height="50dip" android:layout_weight="1"/>
<TextView android:text="2" android:layout_width="wrap_content"
android:layout_height="50dip" android:layout_weight="1"/>
<TextView android:text="3" android:layout_width="wrap_content"
android:layout_height="50dip" android:layout_weight="1"/>
<TextView android:text="4" android:layout_width="wrap_content"
android:layout_height="50dip" android:layout_weight="1"/>
<TextView android:text="5" android:layout_width="wrap_content"
android:layout_height="50dip" android:layout_weight="1"/>
<TextView android:text="6" android:layout_width="wrap_content"
android:layout_height="50dip" android:layout_weight="1"/>
</LinearLayout> </LinearLayout>

View 8 Replies View Related

Android :: How To Make Children Of Selectable Table Row

Sep 23, 2010

I'm making a image gallery with infinite vertical and horizontal scrolling. I put images inside a ListView to make a column, and put the ListViews inside a TableRow. However, it seems that child views of TableRow is not selectable and as a result I can't select the images in my ListView (easily). Is there a way to pass the events down to child views of TableRow so they can be selectable?

View 2 Replies View Related

Android :: How To Make Children Of Selectable TableRow

Sep 23, 2010

I'm making a image gallery with infinite vertical and horizontal scrolling. I put images inside a ListView to make a column, and put the ListViews inside a TableRow. However, it seems that child views of TableRow is not selectable and as a result I can't select the images in my ListView (easily). Is there a way to pass the events down to child views of TableRow so they can be selectable?

View 1 Replies View Related

Android :: How To Access All Children Of Preference Screen ?

May 11, 2010

I'm trying to programmatically uncheck all the CheckBoxPreference children of a PreferenceScreen in my app. How can I do that?

View 2 Replies View Related

Android :: Scale A View Without Resizing Its Children?

Apr 2, 2009

I need to resize the height of a layout so i tried to apply a scale animation. The view is resized but its children are resized too. Is there a way to resize the layout without resizing its children?

View 3 Replies View Related

Android : Extending AdapterView - Getting Only 1 Level Of Children

Feb 16, 2009

I'm creating a custom widget that extends AdapterView. Imagine something like a ListView except that the list items can overlap each other with some transparency. Because of the overlap, I'm trying to control the layout and drawing order of the children.

My issue is that the control renders it's children, but ONLY one level deep. Each child is inflated from an XML resource that contains a FrameLayout and an ImageView. The FrameLayout draws, but the ImageView is never visible. I assume I need to call some method to tell the FrameLayout to layout or draw it's children, but I'm not sure what, why, or where. Does anyone know what I'm missing?

Here is the relevant code for my custom widget: Code...

View 3 Replies View Related

Android :: Drawing Children In Custom Linear Layout

Feb 9, 2010

I have a linear layout that I have overridden because I want to > dynamically add other views to it. I am trying to add some textviews > to it and I call addViewToLayout in the onLayout method. Can't you just add your views to the layout using addView()? I have one custom LinearLayout and this is what I do and it works fine. No need to override onLayout() or onDraw(). Maybe try that

View 10 Replies View Related

Android :: Custom ListView Selected Item Children?

Oct 27, 2010

I have a custom listview row that contains a number of textView components. Instead of the "standard" single text item, I have created a item where each listview row contains several bits of information. For this example, I have a record id, a name, and a description for each row in the listview. I have my listview populated via
this.mDbHelper = new RecordDBAdapter(this); this.mDbHelper.open();
Cursor c = this.mDbHelper.fetchAllRecords(); startManagingCursor(c);
String[] from = new String[] {RecordDBAdapter.ROW_ID, RecordDBAdapter.NAME,
RecordDBAdapter.DESCRIPTION};
int[] to = new int[] {R.id.recordId, R.id.lblName, R.id.lblDescription};
// Now create an array adapter and set it to display using our row
SimpleCursorAdapter records = new SimpleCursorAdapter(this, R.layout.record_row, c, from, to); this.list.setAdapter(dives);

Now what I want is to be able to access the recordId value within each clicked item. I've tried to follow the Android tutorials to no avail. They do something like
Object o = adapter.getItemAtPosition(position);
but that still doesn't help either. What I really want is to get the value of the recordId within each selected listItem. Does anyone know how this would be accomplished? Here is my onItemClick event:
protected OnItemClickListener onListItemClick = new OnItemClickListener() {
@Override public void onItemClick(AdapterView<?> adapter, View view, int position, long rowId) {
// My goal is either to grab the value of the
// recordId value from the textView, or from the adapter.
//Object o = adapter.getItemAtPosition(position);
//Tried this, no joy
Intent intent = new Intent(NeatActivity.this, SomeOtherActivity.class);
// intent.putExtra("selectedRecordId",val); //val here is a numerical record row id being passed to another activity.
startActivity(intent); } };

View 1 Replies View Related

Android :: Block Click - Focus On Layout And On All Children?

May 26, 2009

I was wondering if its possible to block the onclick events on a layout and all the children inside the layout.

for example, I have a LinearLayout and inside that I have buttons and an editText. At a certain point I don't want the user to click on the buttons or edit the text. Is there a way to block that? Do I have to do it for each view? or I can do it for a Layout? What is the best way to do this?

View 2 Replies View Related

Android :: Can Force A Specific Layout Orientation - But Have An Opposite Keyboard Orientation Android

Aug 19, 2010

I understand how to force a specific orientation per activity in the android manifest. I would like to know if it is possible to allow the keyboard to change orientation even though the activity(the layout really) must remain unchanged.

View 1 Replies View Related

Android :: ExpandableListView Displays Expand/Collpase Icon Even If There Are No Children

Nov 18, 2010

I have a ragged hierarchy of parents and children. In that there are some parents that have 5 children...and some parents have 0 children.

The expandableListView displays the "Expand/Collpase" icon even if there are no children.

Question-Is there a way to hide the icon for only those Parents(rows) that have no children? I still want to show the row of the Parents with no children. And allow a user to click on them. But the "Expand/Collapse" icon is confusing.

View 1 Replies View Related

Android :: Unable To Select Children (textview) Of TableRow Programmatically / Fix It?

Nov 2, 2010

I'm trying to access the textviews (for starters, eventually replace with imageviews etc) which are stored in the tablerows in the code below.

The line beginning 'log.d' was the part I was working on, trying to get it to print out the contents of the 2nd text view in the first row, but I can only get as far as selecting the tablerow using "getChildAt(i)".

Trying "getChildAt(0).getChildAt(1)" doesn't select the textview as I would have expected it to; says that it's a View and as such, doesn't have this method - though unless I'm mistaken, aren't tablerows ViewGroups, which do have this method? code...

View 1 Replies View Related

Android :: Linear Layout Focus And Children Change Foreground Color?

Nov 18, 2009

I have a LinearLayout with 2 text View as its children. How can I make the children of LinearLayout to change foreground color (in this case, the text color of the text view) when the linearlayout has focus?

<LinearLayout> <TextView android:id="@+id/name" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:textAppearance="?
android:attr/textAppearanceSmall" android:textColor="?android:attr/textColorInverse" />
<TextView android:id="@+id/value" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:textAppearance="?
android:attr/textAppearanceSmall" android:textColor="?android:attr/textColorInverse" />
</LinearLayout>

View 2 Replies View Related

Android :: Code To Create On Click Event For Children In Expandable List?

Aug 5, 2010

I am playing around with this example.
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList2.html

I cannot figure out how to attach a listener to the children elements so that I can trigger some action when the user taps on the phone number.

View 2 Replies View Related

Android :: Using Orientation Sensor To Get 360° Orientation

Jul 17, 2009

I have a problem with working with the ORIENTATION values of the SensorManager. I would like to have some kind of 360°-value which directly shows me if the phone is in normal portrait (0°), landscape, portrait turned around (180°) or anything in between. So I could have, for example, an arrow that points to the floor (like gravity would do with a plummet) all the time, no matter how I tilt (sidewards) the phone. I thought this would be easy, but I'm pretty confused at the moment.

First of all, the X value of the orientation-array seems to correspondent with how I turn the phone, BUT: if it's completely uprightly standing, this value is about 60° ... why not 0° (or 90°, 180°, 270°), as I would expect?

Second: The value resets if I turn the phone and Android automatically changes screen orientation. So both in Portrait and in Landscape mode it will be sth. like 60° when the phone is in a 0° angel in real world. I set "android:screenOrientation" to "landscape" but this doesn't help anything :/

I want the app NOT to change orientation when I turn the phone, but I want it to get a continuous orientation value when I tilt the phone.

View 4 Replies View Related

Android :: ListView - Making The Parent Expand To Show All Children When AddingListViews Within ListViews

Feb 9, 2010

Basically, I have a custom ListView in which each item looks like:

CODE:..........

The ListView in each item is GONE by default and is set to VISIBLE when the button is clicked. Everything seems to work fine with the exception that when the ListView is long enough to scroll, it is just kind of truncated. http://img38.imageshack.us/img38/3269/listviewproblem.png

Is this a problem with the maximum height of an individual list item? Is there a way to force the list item to expand and force the child listview to expand to show all children?

View 1 Replies View Related

Android :: How To Make Listview With Selectable Children Stop Scrolling On Touch Event

Oct 20, 2009

As a work around to the issue where a list item isn't focusable if it has a focusable child item (a comment by Romain Guy was that this was intended behavior, for accessibility reasons) I simply filled the listItem with two children, each of which is focusable - There's nowhere to directly touch on the listItem anymore, just it's children.

For the most part this is a useable workaround, effectively invisible to the user, except for one thing- Although you can scroll by swiping without issue, touching to *stop* the scroll no longer works- I imagine because the child item is capturing the touch event and not passing it to the parent listitem, at least while the scroll is in effect.

Is there a known workaround for this? Perhaps someway to "pass the baton" of the touch event back up to the parent listItem, or a way to change my design?

BTW- I know there's some built-in functonality for single/multiple choice listviews (checkbox listviews) - That doesn't actually help in my case. The app is a contact list, and the row children are a relativelayout (populated with contact info) and a clickable phone icon (a one-touch dial for the contact), which needs to be visible or invisible depending on whether the stored contact has a phone number.

View 2 Replies View Related

Android : Way To Get A Vertical SeekBar?

Feb 8, 2009

Is it possible to have a vertical SeekBar? I would want this for a tilt control slider.

View 4 Replies View Related

Android :: Scrollview And Listview

Mar 9, 2010

How to add listview inside scrollview ?

CODE:................

I added listview inside scroolview. But its not showing in proper way. The listview is showing only in smaller size.

I tried in most of the ways ? But i can't able to get...

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved