Android Printing Custom Layout - android

I have a custom layout with a border for a receipt to be printed on A5 paper. I m able to get it to work but i m facing one strange issue for the text view which has borders only on the left and bottom side. As everybody uses, i have also used layer drawable as a background. On-screen it is displaying correctly i.e. have a border in the bottom and left. But in print out, i m getting a thin line on the top and right side of the view as well.
Adding screenshots for on-screen view and printed pdf.
How to set the text view border so i do not get thin lines on other sides where i have not set the border?

Related

rectangle layout with a small triangle arrow attached to its side

I am building an Android app and trying to create a list item view for my RecyclerView, that will look like the one in the picture.
I successfully created the view (using 3 RelativeLayouts side by side inside a LinearLayout) but without the triangle arrow.
Can someone please advise on how to reach the desired result with the triangle arrow in an xml drawable?
Please note that the rectangles should have same x coordinates and only the arrow needs to "invade" to the adjacent layout area.
you can add images with the desired color with attribute center vertical to true, you can find the icons on https://material.io/icons/

How do I narrow the right content bound for a 9 patch image?

From Android Studio 1.0 Compile Error - Can't have more than one marked region along edge the bottom and right sides define where to put the content.
I have a chat bubble png coming from the right I am converting to a 9patch via draw9patch. When i draw the right border, I cannot push it inwards to avoid the text going into the triangle portion of the chat bubble.
How do I restrict the text to be contained within the rectangle portion of the chat bubble?

Android layout vs. custom view

I want to generate the following for my Android application.
I tried to achieve this using RelativeLayout and some drawables (empty circle, filled circle, dotted line) I created using XML , but I am not even close to it. Is it the right way to generate such views with layouts. If so, is RelativeLayout is the way to go? Or should I create a custom view for that?
why are there 4 dots between the last item and the one before it, while the other have 3 dots?
anyway, i think you can achieve those results by having a listView with custom items.
each item would be shown as a relativeLayout with 2 imageViews (one below the other) and a textView on the right of the upper one.
the upper imageView would have the large dot (filled or not), with optional dots above it, and the imageView below would stretch its size according to the textView (align to its bottom plus add some more for extra small-dots) and have tiled dots as its background.
another approach would be to have a listView of textViews and an imageView on its left, and you draw the circles according to what the listView is currently showing (even while scrolling). it's much harder, but might be more precise.

how to stretch the sourrounding of padded area in nine-patch image without the content area?

How do I keep the content are as the red part no matter how wide the nine patch background stretches to.
Please see this "zoomed" example image:
Notice: the red part is a virtual illustration for the content area
This is a handle for a SlidingDrawer for comments.
This image is ok on portrait view, but in landscape the virtual (red) area expands such that when I write some text and center it it appears beside the green tab not in the center of the green tab
Here is how it looks like in portrait and in landscape (Please notice the red part is virtual just to illustrate the content area).
In the 9-patch tool you defined the top patch area outside the red content area.
You can define a split patch area. Try covering some red and covering some of the picture's right side.
Your left patch seems too big too. Try this:

Nine-patch image shows strange behaviour?

I am creating an app in Android which implements Chat feature in it. I have 2 kind of chat bubbles - blue for other user and orange for logged in user. I am using Nine-patch images for these bubbles because the bubble can be stretched.
The text in the blue bubble is showing fine - right in the center(as shown in the figure below). But the text in the orange bubble is showing after some vertical gap from the upper border of the image. I can't figure out why this is happening. Both the bubbles have same properties and have been created following the same procedure. Please help. Thanks in advance.
Here is the orange chat bubble:
The problem is in the nine-patch.. the right hand border defines where the content goes and you have it starting just under the pointy part of the speech bubble. Continue the border up to where you want the content to start and it will work!
To clarify: the right and bottom borders define where the content can go, and the top and left borders define the area of the image that will be repeated when the image needs to be stretched.
Try this:
draw9 will stretch as what you want.
//your image width is too long. use this one for your reference.
//this image will work fine for me as I am using for left side.
your orange chat bubble is also fine if you put one dot on the right side above the arrow.

Categories

Resources