I'm trying to create a bunch of RelativeLayouts inside of a LinearLayout, defined via XML. It would work well, except that I have to place one image beside another; hence the RelativeLayout issue (otherwise I'd just place a bunch of TextViews and stuff directly into the LinearLayout). The RelativeLayouts show, but each view I add to each RelativeLayout overlaps each other. For example, as you'll see in the following code, I call addView on the current RelativeLayout with three TextViews, an ImageView, and a Button, but they all overlap each other. Here's my code:
I apologize if there are a lot of commented-out sections; I've been toying with this for decades lol. If anybody knows how to place one View below another in a RelativeLayout, WITHOUT using XML (these are multiple instances of RelativeLayouts; since you can only call an XML RelativeLayout once from my experience, the layout must be done manually via Java ), please let me know.
if anybody knows how to place one View below another in a RelativeLayout...
AFAIK, all the layout_below, layout_RightOf et al. attributes of a RelativeLayout that you find in XML are termed as "Rules" and there is a addRule() function in the RelativeLayout, if I am not mistaken. You can add any of these rules with addRule() function and have your views placed one below the other.
Also, can you use <Code> button and reformat(Edit) your original post, that way it becomes easier to read.
AFAICT, the way it works is:
You have a parent RelativeLayout and when you add Views(or ViewGroups) to it you call addView(view,params) variant of the method. If the params contain any rule these are applied to the child views inside this parent.
It should print out the first one to the left side of the parent, and the second one should be below the first one? Would these layouts be passed outside of my getnewRL method? Because I want to pass each RelativeLayout, with these parameters, to the onCreate() method, which adds these RelativeLayouts to a LinearLayout.
Sorry for all the questions, my internship has me working on this and nobody there knows how to program in Android
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database