Android :: Views And Their Child Views - How To Avoid The Ugly - Boxes - When Child Views In A View Has Another Color Than Background

Jan 6, 2010

I have a simple ListView and on that ListView I have placed a number of custom defined Views. The CustomView has ImageView and two TextViews.

The CustomView also has a "stateful drawable" as background, so that the background image (a 9-patch) changes if you press the Row in the ListView. When pressing the Row, the background image changes to a Red-ish thing.

The problem is that when the background changes from the default greyish, all the Views in the CustomView (ImageView and TextViews) still have their greyish background and thus creates very ugly greay boxes on top of the now redish background.

What is the best way to solve that problem? I hoped that such things were handled automatically (as it is done in for example .NET), but I was wrong it seems.

Android :: Views and their child views - how to avoid the ugly - boxes - when child views in a View has another color than background


Android :: Do Root Views Of An Activity In Android Have Any Prior Knowledge Of The Child Views That Will Be Loaded Into Them

Jan 25, 2010

Is there any way to query a root view of an activity for all of its child views even before the root view or its children have been inflated? I guess what I'm looking for is whether a view knows ahead of time what children it will have before it gets inflated, and can I get that list in some way. Bizarre I realize, but I think it will help me with some unconventional automation testing I'm working on. I haven't found anything in the API like this.

View 1 Replies View Related

Android :: Add Child Views To Main View

Oct 23, 2010

I am trying to figure out how to add a child view to a parent view so I can use the MotionEvent.ACTION_MOVE feature to move from one child view to the next. Is this possible?

View 4 Replies View Related

Android :: Child In Particular Place In Views Or Layout?

Sep 7, 2009

I am facing problem in fixing the child in particular place in views or layout.

1) Can I fix the child at the starting and ending of Layout directly?

2) Can I fix the child at the starting or ending of the view directly?

View 1 Replies View Related

Android :: Re Ordering Child Views Of A Layout

Aug 29, 2010

I have a number of child views, each child is a TableRow and I need to be able to change the order of the TableRows, such that I can swap the rows into any order. I know there is a method called removeAllViews() but I don't really want to remove and re-create the views if its possible to access and change the order. I really want the display to update as smoothly as possible, taking the minimum amount of time, is it possible?

View 2 Replies View Related

Android :: Why Add Child Activities To TabActivity Instead Of Simply Using Views

Mar 17, 2010

I've been programming in Android for two years now and just joined an Android project where they are using a TabActivity to host multiple Activities. It's unclear why this is better than rewriting the TabActivity to simply use Views instead.

TabActivity extends ActivityGroup which means TabActivity can host both Activities and Views. But what's the use of this capability? I was under the impression that Activities should be treated as individual screens of an application.

In short, what is an example use case where it's recommended that TabActivity should host multiple Activities rather than multiple Views?

View 4 Replies View Related

Android :: ExpandableListView With My Own Layouts For Group And Child Views

Sep 20, 2010

i've got an ExpandableListView with my own layouts for the group and child views. a certain group-type will require a different layout. is that possible - i.e. a ELV with different layouts for a group view. i've got my own sub-class of SimpleExpandableListAdapter.

View 6 Replies View Related

Android :: Setting Focus To Listitem's Child Views

Jun 8, 2010

Is it possible to give Focus on listitem chile views , what i need is i have an custom list view , i creating each row using linear layout with two views like button and textview, now i want to get that button click event and have to change the background color while focusing is it possible?

View 2 Replies View Related

Android :: Setup Child Views Inside A Viewgroup?

Aug 31, 2010

Can someone help me with my Syntax/Methodology? I would like to set up a bunch of different views in a viewgroup. My code fails at the addView method.

Unfortunately, I can't find jack for examples (which is how I learn) using the ViewGroup class online.code...

View 2 Replies View Related

Android :: Long Click On Child Views Of A ExpandableListView / Enable It?

Feb 28, 2010

ExpandableListView has a setOnChildClickListener method, but lacks of setOnChild*Long*ClickListener method.

When I added setOnLongClickListener() on child view in getChildView(), whole sublist became completely unclickable (despite of parentView.setOnChildClickListener() present and working before).

How can I enable long clicks on child views?

View 1 Replies View Related

Android :: Multiple Child Views Created Programmatically Not Working / Make It To Do?

Sep 27, 2009

I need a LinearLayout to contain 3 TableLayouts, and I can't get it to work. This is where the problem is I'm sure:

mTableLayout.addView(mLinearLayout, LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); mLinearLayout.addView(nTableLayout, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); mLinearLayout.addView(oTableLayout, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); mLinearLayout.addView(pTableLayout, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

How Do I make this work? I can get it to work just find when I only add a single child view, but when I have multiple children view objects my app crashes.

View 6 Replies View Related

Android : Aren't Focus States Supposed To Bubble To Child Views?

Apr 19, 2010

When using a View within a View, for example an ImageView within a LinearLayout, both of which have xml drawable resources (the LinearLayout as a background) specifying PNG drawables to use for the on/off states, shouldn't children Views receive the focus state when their parent gets focus? So as far as I understand, both my LinearLayout and ImageView should be switching to their focus states right? Apparently not Or, more likely, apparently my implementation is incorrect.

The focus state works on the LinearLayout but my ImageView never receives focus.. I have both Views set to android:focusable="true".

You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

View 2 Replies View Related

Android :: Child TextView In ScrollView With Large Amount Of Text Pushes Other Views Off The Screen

May 6, 2009

I am trying to create an activity layout that has a top level vertical linear layout like so:

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

This works ok as long as the wordDefinition text isn't very long. But, when I set the text to something very long, it pushes the back button off the bottom of the screen. Why? Isn't the ScrollView supposed to scroll the text in the child TextView?

I've tried playing with weights (e.g., giving the top text view a weight of .2, the scroll view a weight of .7 and the button a weight of .1, but to no avail.

View 4 Replies View Related

Android :: Child Views Of Particular Table Row In Table Layout?

Jul 15, 2009

Here is my screen description: It is a TableLayout and it contains multiple Rows. I have set TableRow as clickable, as I want to go to next screen on click of a tableRow. Everything I am doing through Java programming (instead of XML layout, because number of TableRows changes each time) On next screen, I wanted to display all the views of that particular clicked TableRow. Here the problem i am facing is how to capture particular tableRow on onclick() even and how do I get all the textviews of that particular Row. I tried to set id at runtime, and tried to get id of view, but it's not working, giving error resourcenotfoundexception.

View 2 Replies View Related

Android :: How Can Update The All The Views Inside A TabHost When Pressing On A ContextMenu Item From Within One Of The Views

Nov 16, 2010

I am implementing a music player application in Android. My play list selection screen is implemented as a tab selector widget which contains a ListActivity inside each of the tabs: Artist, Albums, Songs.
I want to update the ListView in each of the ListActivity when I delete an item from any of the lists.

i.e. When I long press an item in the Artists list a context menu is drawn with "Delete Artist"
And it should delete all the songs from this artist in the Songs ListView, delete all the albums by this artist in the Albums ListView, and finally delete the entry for the artist in the Artist ListView.

Each of the ListActivity has its own fillData() method, which updates the ListView when the button in the context menu is pressed.

How can I call the fillData() method of the Albums ListActivity after I update the ListView inside of the Artists ListActivity?

View 1 Replies View Related

Android :: How To Make Use Of Views Defined In Layout XML File As Template To Create Views Programmatic Way

Feb 28, 2010

I want to populate a table, defined in layout xml file through the programmatic way. I have define Table with a single row defining its header, with all the attributes set. Now i want to know a way so that i can just replicate that header row in the table with new content.

I tried using inflator inflate(int,view) method, but at runtime it showed up with error.

Here is the XML code for the layout file defining the table

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

View 1 Replies View Related

Android :: Switching Views With RadioButton And Saving Views In Bundle

Mar 6, 2010

I have the following XML code:.................

The idea is to change the views, whenever I press one of the radio buttons. When I press a button the first time everything works out fine, but the second time I press a button, I get an IllegalStateException, and I can't quite see why I'm getting this.

Also, the Activity seems to set all my global variables to null, which is why I have to create them every time I switch from portrait to landscape or vice versa. So I would like to know if there is a way I can save my views in the Bundle, or any other way in which I can permanently save my views, so I don't have to add or create them every time, I flip the phone. And whenever I flip the phone, it seems that it rereads the main XML file, causing the RadioGroup to be set to 2D even if the 3D button is checked. This is because I've said the 2D button to be checked from when the app is first created, but I would like to also save the state of that RadioGroup.

View 5 Replies View Related

Android :: How To Align Views In The Middle Of Another Views Baseline

Jun 16, 2010

How do you align views relative to the "middle" part of another view? I think it is best explained with a pic of the UI I'm trying to create in android.

View 2 Replies View Related

Android :: Programmatically Add Views To Views

Mar 7, 2010

Let's say I have a LinearLayout, and I want to add a View to it, in my program from the Java code. What method is used for this? I'm not asking how it's done in XML, which I do know, but rather, how can I do something along the lines of (One View).add(Another View) Like one can do in Swing.

View 2 Replies View Related

Android : Avoid Re-drawing All Views In An ArrayAdapter?

Mar 25, 2010

I have an ArrayAdapter powering a ListView. I would like to change the data behind the ArrayAdapter and update the ListView's. Sounds like notifyDataSetChanged(); would be exactly what I am looking for, but it updates the entire ListView, and I would prefer to update on a row-by-row basis.

Is there a way to do this with ArrayAdapter, or do I need to manage my data some other way if I want this functionality?

View 1 Replies View Related

Android :: How To Avoid NullPointerException When Using Custom Views Or SurfaceViews

Jun 12, 2009

I created a custom SurfaceView called CaptureView and tried to add it into main.xml file.The application seems to work fine but if I switch from main.xml tab to Layout in Eclipse the text NullPointerException appears instead of layout preview.Does anyone know how this issue could be solved?

View 2 Replies View Related

Android :: How To Cache Views And Avoid Calling OnCreate Everytime

Apr 27, 2009

With Android, I've got an application that seems calling "onCreate" every time on a new instance of an activity, because this activity is the son of an another and it finishes itself while it ends its role for one piece of data.

The calling of "onCreate" everytime seems to be re-parsing the xml to create the views and re-attaching/re-creating the listners to the code and so on. So Is there a way to "cache" an activity to be recalled everytime, without seeing it if we click on "back" in the mobile devie? it's like having it really hidden (not accessible with the back button) and destroyed only if it's necessary.

View 4 Replies View Related

Samsung Epic 4G : Avoid Getting Mobile Views (page) On Web Sites In Browser?

Sep 20, 2010

Does anyone know how to avoid getting mobile views (page) on web sites in the browser? I can't figure it out. My old HTC Hero had a way to not get the mobile versions..

View 8 Replies View Related

Android :: Pre Scale Background Example / Speeding Up Web Views

Apr 28, 2010

I've created a custom ViewGroup (based off of the Launcher) that allows paging scrolls between some WebViews. Problem is that it doesn't scroll as smoothly as I want it to. I've been following Romain Guy's 2008 advice, but I don't see any massive improvements. Is it because I am using WebViews, or am I just doing the prescaling wrong? This is my code:

Bitmap originalImage = BitmapFactory.decodeResource(getResources(), R.drawable.redbg);
originalImage = Bitmap.createScaledBitmap( originalImage, // bitmap to resize ((WindowManager)
getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getWidth(),
// new width ((WindowManager)getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay().getHeight(), // new height true); // bilinear filtering
getWindow().setBackgroundDrawable(new BitmapDrawable(originalImage));
called from onCreate. Is the right?

View 3 Replies View Related

Android :: List View Focus - Child View As Background

Jun 25, 2010

In my app i'm setting background to each child views in listview. So that listview default focus ( orange color ) is not focusing. Is there any way to set both ( listview focus & child view background)?

View 1 Replies View Related

Android :: Background Hides Child View Text?

Aug 1, 2010

I have a simple LinearLayout. When I add the android:background to the LinearLayout, the TextView is no longer visible. What am I not understanding?

<LinearLayout
android:id="@+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="53px"
android:background="@drawable/glossy_black_top_bar" >
<TextView android:text="This is the Title"
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textColor="#FFFFFF">
</TextView>
</LinearLayout>

View 1 Replies View Related

Android :: Putting Views On Top Of Other View

Feb 9, 2010

I'm still trying to figure out how best to layer views on top of other views. I want to do something like the ZoomButtons on top of a custom view. I tried getting the ZoomButtonsController's parent and then adding views, but I didn't have enough control and they ended up on top of the buttons. I've gotten close by using a FrameLayout and some gravity on the top two views. But this has some interesting effects. Since this is contained with a tab, these two top views appear on top of all four of the tab pages. I want them on top of one of those pages only. Apparently, nested FrameLayouts don't mix well. What is the proper and expected way to do this? Here is more or less my complete layout....................

View 4 Replies View Related

Android :: Adding Views To Another View

Oct 9, 2010

Is there a possibility to add a view or derivative (button, textview, imageview etc...) to another view without having to go through layouts?

I have a class called ScreenView, it derives from View (e.g. public class ScreenView extends View).
I wanted to display text into it, labels, images etc..

On an iPhone it's trivial, simply create my objects and use addSubview method ; you can embed any UI objects into another. Most UI toolkits work that way too.

Problem with layouts is that I haven't found an easy way to properly position a subview (say a text view) in a given location of the enclosing View. I want one to contain the other...

I was hoping I had missed something in the documentation (which is far from being intuitive that's for sure) and I could do something like myView.addView(subview). But it ain't so :)

As a side question, what is the closest to iPhone's UILabel in the Android world?
A UILabel can contain a text or a graphic. Right now I've been using TextView and ImageView but they aren't anywhere as flexible when it comes to layout as a UILabel

Edit: Making my View inherit from ViewGoup instead, let me add subview..
However, I want to draw in my view. I found that when ScreenView extends ViewGroup, the onDraw function is never called then.

Something like:

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

Would paint in yellow my view if ScreenView extends View ; but not if it extends ViewGroup.

How do you draw directly in the view then?

View 2 Replies View Related

Android :: Updating Views Of Sub Activities Of TabActivity From Background Process

Jul 25, 2010

I am using a TabActivity (Main) with 3 TabSpecs

I am using Intents for the content of the 3 Tabs

TabA, TabB, TabC for example.

All these tab activities use common data that is stored in SharedPreferences

In the Main TabActivity I have an options menu which has a refresh option.

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

This refresh uses an AsyncTask (updateCommonDataFromWeb) to reload the common data from the web.

I need a way to tell the 3 tab activities to refresh their views and rebuild their content from the newly downloaded data.

When the tab activities are first created they load the data from SharedPreferences like so:

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

I thought about making a common method on each of the tab activities
like.... reloadViewData()

I thought maybe I could use the activity manager from the Main TabActivity to get the activity of the current tab like so:

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

Unfortunately i cant get this approach to work, whilst activity is the correct instance its an Activity instead of a TabA,TabB or TabC

Maybe i've completely taken the wrong approach to the whole thing.

I have also read alot about not using Activities for tab content instead using views.
However I dont know what view to use to replace my <RelativeLayout /> as i cant use my R.layout.* as views.

View 2 Replies View Related

Android :: How To Disable A View Provided There Are 2 Views In Xml?

Mar 25, 2010

The reason for me to do this, I have created these 2 views in the beginning of the app. SO they are always present. But in some cases where i want only 1 view(which is surfaceview) and if i dont need the 2nd view(i.e, videoview), i am still getting a black patch at the palce where i have defned a videoview. want to get rid of this. Can anyone please tell me if it is possible to disable views/surfaces corresponding to them? If so how can we do this?

View 2 Replies View Related







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