java - Using setMaxLines on a TextView shows lines but not text in lines -


I have an app that takes menus from the server and parses it on textuals and buttons; Names are available for some time, so I want to present 3 first lines of name (if it's many), then the problem is that when I set the maximum of 3, I see 3 lines but only the first line The text is the same, the odd thing is that when I set the Settlements to 3 To goods, I can see three lines and text, but there are 3 lines in my name only one line long.

Code:

  Private Zero createItemView (item items) {/ * Create a layout panel for all views / View / Relative LayoutPanel = New Relative Layout (this); / * Create visual for item name * / text view item name = new text view (this); itemName.setTextColor (.getResources () getColor (android.R.color.white)); itemName.setTextSize (itemToAdd.getNameSize ()); itemName.setSingleLine (wrong); itemName.setWidth (300); itemName.setMaxLines (3); itemName.setText (itemToAdd.getName ()); / * Add button view / TextView addButton = new text view (this); addButton.setTextColor (.getResources () getColor (android.R.color.white)); AddButton.setTextSize (itemToAdd.getNameSize () + 5); addButton.setText ("+"); / * See price * / Text view value View = New text view (this); priceView.setTextColor (.getResources () getColor (android.R.color.white)); PriceView.setTextSize (itemToAdd.getNameSize ()); priceView.setText (itemToAdd.getPrice ()); / * Adding View to Panel / ViewPanel.addView (AdButton, Writer); viewPanel.addView (Valueview, Center Param); viewPanel.addView (item name, left paraam); / * Adding Visual Panel to Layout * / menuLayout.addView (viewPanel); }   

Parameter for ideas:

  / * Here to create linear layout * / menuLayout = new linerlayout (this); menuLayout.setOrientation (LinearLayout.VERTICAL); MenuLayout.setBackgroundColor (get.resources () getColor (android.R.color.background_dark)); / * Create rules for relative layout here / / right Parameters = New Relative Layout LayoutParam (View Group Layout Layouts. WRAP_CONTENT, View Group. LayoutParmsWRAP_CONTENT); LeftParams = New Relative Layout. LayoutParms (see group layoutperms.wrap_CONTENT, view group layoutperms.wRAP_CONTENT); centerParams = New Relative Layout LayoutParms (View Group Layout Layouts. WRAP_CONTENT, View Group. LayoutParmsWRAP_CONTENT); / * Add rule / rightParams.addRule (relative layout .ALIGN_PARENT_RIGHT, relative layout. TRUE); leftParams.addRule (RelativeLayout.ALIGN_PARENT_LEFT, relative layout. TRUE); centerParams.addRule (RelativeLayout.CENTER_IN_PARENT, relative layout. TRUE);   

Photo:

can not see text

I'm sorry for your bad english, thanks!

It seems that this is a problem in the next line:

  leftParams.addRule (relative layout .ALIGN_PARENT_LEFT, relative layout. TRUE);   

For some reason (I'm not sure why, maybe a bug) its not working, you can not just add the parameters, and the relative layout is left to the layout of your text view And you'll see the text.

Hope it helps

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -