How can I create a body text in xml android - android

I want to create title,body of text, other icons such as picture and link. How can I display the title and body of text as shown in the following picture? Which layout is better ? Constraint, Linear or Grid? How do we choose these layouts?

Constraint layout is best layout & much more flexible.
For title & body, you can use CardView at background and place your views like TextView/Edittext, ImageView/ImageButton on it. You may need to place another Constraint Layout in cardView for its inner view

Related

Can we display emoji from keyboard into Linear Layout?

I'm trying to add emojis in a LinearLayout but I don't know if it's possible or not. What I want to do is when I press emoji it should appear in a LinearLayout rather than EmojiEditText. Is it possible?
I have searched for quite a while but I can't find any solution to my problem. Please suggest a library or solution that supports displaying of emojis in LinearLayout.
Rather than go for library, You can do from scratch as well.
Make one Linear layout and append that linear layout as the emoji is pressed.
For that, Give ID to the linear layout and append the layout by adding view to it.
LinearLayout linearLayout;
linearLayout = findViewById(R.id.linearLayout);
linearLayoutAmi.addView("VIEW_ACCORDING_TO_EMOJI");
Emojis are in text format, and LinearLayout does not have a text property unlike a widget. Wrap each selected emoji in a TextView and then add the textview into the target LinearLayout as child view.

How to add TextView at below in a RelativeLayout when there is no space at right?

I've seen many of questions for how to add TextView in a RelativeLayout programatically, but everybody adding it in LinearLayout with orientation vertical. Can any one suggest me or give me a link that how to add multiple TextView in RelativeLayout at right until it has space and then change the line.
I want a layout like this..
May be this works for you !
You can customize chips-edittext-library for your need. Customizing by setting background to transparent, and editable to false.
-> Or you can use any other library which is used for displaying emoticon in EditText and customize it according to your need. Like android-emoticon-edittext-spike
You can use the Flow Layout library that manages the view arrangement itself.
When there is no space left the added View is moved to the next line

Leave blank line in Linear Layout

I am developing for android. The app is designed in XML in Linear Layout. What I want to do is to leave some blank lines between the consecutive buttons/text to ensure some neatness in the GUI. Is it posible to do it in Linear Layout? Please help...
You should use margins to seperate different components in your layout. An example of how this would look in your XML is: android:layout_marginTop="12dp"
If you want to leave space outside the border of text/button and next view elements you can use android:layout_marginLeft, android:layout_marginRight, android:layout_marginTop and android:layout_marginBottom.
If you want to leave space between border of the text/button and actual content of the text/button you can use android:paddingLeft, android:paddingRight, android:paddingTop and android:paddingBottom.
For more info check out this question
how to increase the space between the elements in linearlayout in android?

Align a layout top of a image that is centered

I have a relative layout, inside of it is a ImageView that is centered in its parent.
I want to add a share up to the image. If I put this attribute android:layout_alignTop="#+id/myImage" the button will appear over the image. I want to be upper than this.
Use
android:layout_below="#+id/shareId"
in your <ImageView> tag. Or
android:layout_above="#+id/myImage"
in your share's View tag depending on what works better for you. If this doesn't fix it then please post the xml and a picture of what you want/have if possible.
RelativeLayout Docs shows the different properties that can be used.

Removing the margin from bottom in android Relativelayout

Hello i have used a Relativelayout in android using XML but when i see image in graphical layout there is small margin left at bottom in different screensizes.How to remove that margin.I also used a ScrollView in layout.
I think you have to set bottom margin in negative
like
android:layout_marginBottom="-10dip"
Check whether you have used padding for your layout,
Better post your layout file and/or screenshot.

Categories

Resources