Difference between android:layout_alignParentTop and android:layout_alignParentStart - android

The documentation says:
android:layout_alignParentStart
If true, makes the start edge of this view match the start edge of the parent.
and
android:layout_alignParentTop
If true, makes the top edge of this view match the top edge of the parent.
So what's the difference between start edge and top edge?
I'm sorry if this question is already answered, I just couldn't find it. Blame my poor Googling skills.

As far as I know Layout attributes ending with "Start" are used to match the start of content direction like supporting RTL texts where the start of the View is not the default.

Native support of Right-to-Left (RTL) languages was introduced in Android v4.2 (Jelly Bean). Here is the official blog entry on this
To support RTL, it's advised to replace Left/Right layout properties to Start/End equivalents. Top/Bottom attributes, however, remained intact.
Please, read the blog entry for the details, there's no need to copy it here.

Related

Why Android Lint strictly discourages the use of Gravity.LEFT or Gravity.RIGHT?

I understand that texts may be LEFT or RIGHT on different languages, so that END or START may be useful for international apps.
However, LEFT or RIGHT as Gravity are also simple placement of things. If I want my button or icon to be aligned to the RIGHT, why on earth does lint complain on using END instead? Probably, if use END, the layout will become broken on a foreign device.

Difference between viewEnd and textEnd in android:textAlignment

I was going through documentation of android:textAlignment and it has 7 options few of those are viewEnd/viewStart and textEnd/textStart
I could not understand what is difference in view#### vs text#### using docs from the POV of use cases.If anyone can clarify that in more detail using some examples or use cases?
My observation,
if the textDirection or layoutDirection is ltr then, viewStart/End and textStart/End behaves the same.
But if you change one of the textDirection or layoutDirection to rtl, and now try the view/text start/end, you will visually see the difference.
You can read explanation here: textAlignment
And difference in text and view is pretty simple. I'll explain on an example. Here is a 9.png:
We are interested in right and bottom black rectangles. This rectangles shows where content should be placed (I've marked it with red rectangle for better understanding). In this current case it is a text. But as you can see this rect is not covering the whole image. In uncovered parts text wouldn't be drawn. So view will contain whole image, but text part (or content part better to say) will be lesser.

Is there something like Android's match parent in Delphi?

I want to have components in my android app that will match their parent's size, but I can't find it in the object inspector.
If I use align and anchors it works almost similar, but it's still not as good as android's design.
The easiest way is to use Align property.
If you want your child control to fill the parent's entire client area, set the Align to Client. Note this one does not cover the parent control's borders. You probably know about this one from VCL where it was named alClient.
If you want your child control to cover the entire parent control, including its borders and such, set Align to Contents. This one is a new option that was introduced to FMX and is not available in VCL.
You can read more about Align options in the oficial documentation:
FMX.Controls.TControl.Align
FMX.Types.TAlignLayout

Difference between gravity right and end [duplicate]

This question already has answers here:
What is the difference between Android margin start/end and right/left?
(3 answers)
Closed 5 years ago.
I was making a xml file and was applying gravity to make view content to shift it to extreme right side of window but i saw gravity as right and end.So, what is the actual difference between the both and which one to use where.
in Arabic, Persian and all rtl (Right-To-Left) Locales, end is left but for English and other ltr (Left-To-Right) Locales end means right
Left and right gravities might not work correctly in applications localized for right-to-left languages like Hebrew, Arabic etc. In those languages left and right sides are mirrored to european languages. If you use hardcoded left and right gravities for some elements of your UI, then they might be misplaced in right-to-left localizations. If you use begin and end, then Android will map them correctly to left or right depending on current system language. Thus begin for English is equal to left and for Hebrew to right etc.
If you app has a localization for one of right-to-left languages, then you should always use begin and end. Otherwise you can safely stay with left and right.
In my opinion when we set
android:orientation="horizontal" in the main layout, then it's better to set gravity of its child as start and end to make it more effective with the layout.
BUT
when other orientations are used then we can use other gravity forms as well.

What is android:layout_marginStart

I would like to add some space between the left display border and an ImageView. Android SDK made me aware of "android:layout_marginStart".
Consider adding android:layout_marginStart="10dp" to better support right-to-left layouts
Why should I use android:layout_marginStart="10dp" instead of android:layout_marginLeft="10dp"? I have never done so and never encountered any problems with so-called "right-to-left layouts".
start and end are the same as left and right for left-to-right (LTR) languages. For right-to-left (RTL) languages (Arabic, Hebrew, etc.), start and end reverse and become equivalent to right and left, respectively.
This Android Developers Blog post gets into a bit more detail.
Some APIs were introduced to support languages that use a right to left reading direction e.g Arabic and Hebrew.
One of which is android:layout_marginStart
See the link for more info : http://developer.android.com/about/versions/android-4.2.html#RTL

Categories

Resources