how do I draw a horizontal line in a relativelayout without create a class that extends View and without XML? I need to draw a simply line in a RelativeLayout in a given point of Cartesian plane
            Asked
            
        
        
            Active
            
        
            Viewed 1,775 times
        
    0
            
            
        - 
                    Are you looking for this: http://stackoverflow.com/questions/4432649/horizontal-1px-white-line-above-image-view-in-a-relative-layout? – Harsh Singal Nov 12 '13 at 01:24
- 
                    @HarshSingal- this is through xml... – Rishabh Srivastava Nov 12 '13 at 03:52
1 Answers
0
            You can try out this:
View line = new View(this);
line.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, 1));
line.setBackgroundColor(Color.rgb(51, 51, 51));
layout.addView(line);
There are other ways too through paint.
 
    
    
        Rishabh Srivastava
        
- 3,683
- 2
- 30
- 58
- 
                    I added line.setY(value) and replaced FILL_PARENT with MATCH_PARENT,now it works,thank you – Roran Nov 12 '13 at 10:41
