Image and Text View errors on Android XML

I'm making an app (in Android Studio) and some weird errors are occurring, such as a large space left before the image and the text appearing on top of the image. I have researched but no solutions helped.


<ScrollView xmlns:android="" android:id="@+id/ScrollView01" android:layout_width="fill_parent" android:layout_height="fill_parent"> <RelativeLayout xmlns:android="" xmlns:tools="" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity$PlaceholderFragment"> <ImageView android:id="@+id/logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/logo" android:layout_centerInParent="true" android:layout_centerHorizontal="true"/> <TextView android:id="@+id/section_label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/logo" android:text="Welcome!" android:textSize="35dp" android:layout_centerInParent="true" android:textColor="#fff" android:gravity="center_horizontal"/> </RelativeLayout> </ScrollView>

PS< I also have another problem with the Navigation Drawer template in Android Studio, where when clicking the Example Action button the transparent circle that appears is squared off on one side. Thanks :)

-------------Problems Reply------------

I would suggest adding your components into a LinearLayout and centering that within its parent RelativeLayout.



<RelativeLayout xmlns:android=""




That is because you are using a Relative Layout. I suggest to you to encapsulate the Textview and the Imageview inside an LinearLayout with vertical orientation. I hope that it help you.

Category:java Views:4 Time:2019-03-06

Related post

  • Not able to share image and text to facebook from android app 2014-06-03

    I have made a demo android app,In that I want to share a text and an image from app to facebook,I have integrated the app with facebook,It gives me login tto,But gives an error that "06-03 18:14:27.221: D/Request(21053): Warning: Sessionless Request

  • How to display context menu along with images and text views in Android? 2011-06-29

    I need to display the context menu along with images, text view and radio button. I have searched for answers but couldn't find a good one. I need help regarding this problem. --------------Solutions------------- Create your own custom menu. create a

  • Android images and text via Java programming, not xml layout 2011-07-10

    please is possible to make some activity with images, text etc. via some .java file (Java programming) without xml? - xml use only for strings of text, for multilanguage.... Thanks for help. --------------Solutions------------- Yeah it is possible an

  • Android: how to create a button with image and text that are both centred 2012-04-01

    I got stuck in an odd issue with Android - I want to have a button that looks like this: |-----------------------------------------------------------------------| | [icon] <5px> [text text text] | |----------------------------------------------

  • add image and text on button programmatically 2011-10-21

    I want an image and text "View Details" in my button(red color button) programmatically... image is on left side of button and text on right side.. UIImage *img = [UIImage imageNamed:@"image.png"]; [aButton setImage:img forState:UIControlStateNormal]

  • Android Scroll view Image and text 2013-12-03

    I am solving a problem with image and text in one scroll view. The main problem is, that I get different image height from server side . But the place with image should be all the time same. Now the height of image place is dynamic. The text should b

  • Create List View with dynamic image and text in Android 2011-03-12

    I want to create List View with dynamic image getting from URL and text also get from URL What is the easiest way to implement this List View using Android --------------Solutions------------- If you intend to load dynamic image from URL, it will tak

  • displaying images and text in list view using json 2012-03-27

    I am fetching the images and data from mysql database from server using json array through url. i can able to do listview all images but i can't able to get text along with images. i think i was create custom layout using view can i create

  • Android ImageButton with Image and Text 2010-07-12

    I want to have a button that has an image on top and some text on bottom. Both the image and text are decided during runtime, so I want to be able to combine ImageButton's setImageBitmap and Button's setText for each button. Any ideas? Thanks Chris -

  • how to dispaly image in grid view reading imageUrl from xml using sax parser in android 2011-06-30

    Possible Duplicate: how to display image in grid view reading imageUrl from xml using sax parser in android thanks for answer but i am able to read xml file from url but i need if in xml imageUrl is there so show in grid view ..this is my xml file an

  • How to make a gallery with Image and text for android 2011-11-29

    I wanna make a Gallery, with a picture in the background and a textfield with invisible background... So I can see the text and the Image behind. I already made the Gallery but i cant figure out how to put text in the foreground. --------------Soluti

  • Custom Listview in android application with images and texts 2018-03-08

    I have created database in external storage and i have stored image path and audio paths for each step in tables. Now from a new android application i want to access the table and extract in custom listview with image and text. Image are stored in a

  • How to add the image and text to button in code ? and not via xml 2010-12-10

    How to add the image and text to button in code ? and not via xml --------------Solutions------------- With an investigationtime of 2 minutes you could find this very easily. But this might help you: ButtonName.setText("Content of button text"); Stri

  • Getting the runtime reference of the button and text view layed on dynamically within a for loop in android 2011-01-18

    I am Inflating a custom view in In an Android activity dynamically using a for loop. The view contains an array of button and array of text view. On clicking the button a date picker Dialog opens which has been registered to the button on click liste

  • Send static image and text of list item to the next activity while click on list activity in android 2011-06-29

    I have a list activity, in which I show an image and text in a row. Images are static and these are placed in the drawable folder. I want to print images and text in next activity while clicking on the list item. I can successfully send text view on

  • Android: Differents font color for image and text in webview 2011-07-26

    In my app, I have a webview that contains images and text. I'd like the image (that is latex codecogs style, example: example of latex codecogs image ) to have a white font (If not, I can't really see the equation), and the text to have an other font

  • Is it possible/easy to display a background image and text for an empty table view? 2011-12-16

    I have a requirement to display a table view if there are items to display, otherwise to display a splash screen which contains an image and some text. Is it possible to display the image and text as a background for there table which is displayed wh

  • How to insert and delete image and text in one view just like MMS apps on iPhone 2011-04-18

    I would like to implement something like MMS app on iPhone, where user will have an option to include an image and text. The way I did is i created a UIUiew and included a UITextView and UIImageView inside it, and when user selects an image it goes i

  • How to retrieve image and text from SQLiteDB to display it in a listview 2011-03-08

    I need to store data in SQLiteDB and later retrieve it to display it in a ListView in Android. In both SQLiteDB and the ListView, the data will take the form of image and text per row. Images are stored from sdcard to DB. I have stored my data in the

  • how do i create a custom cursor adapter for a listview for use with images and text? 2011-03-14

    Hi want to create a custom cursor adapter so I can display an image with 2 lines of text. I have had some trouble understanding the custom cursor adapters but I do not understand how to add an imageview to be filled from the path in my database. ----

  • Button containing images and text 2010-11-12

    I have to create a small panel like thing with a border. This should contain a text, an image that describes the text and a button. On clicking that button I have to do some operations also. Which widget is suitable for this? Can anyone suggests any

  • iPhone SDK: UIButton with both image and text possible? 2010-12-03

    I have a button of size width 200 and height 270. I want to have text and image on the same button. Not as a background image on that text. Instead of this, I want to display the text with height 120 and image of height 150 on the same button. Anybod

  • how to set Image and text at the center of the button 2011-05-19

    i have set my buttons width to fill_parent. so Is it possible to set Image and text at center of button. there is option for drawable_Left but it aligns image on left side of button... I want something like this. .... [image][text].... | Thanks: ----

  • Exception when we want to share image and text via Facebook sdk 2011-08-20

    I have problem that When we want to share a product with its image and text on facebook with the help of facebook sdk (Fb Dialog) then it gives an error message as following: Error Stack: * 08-20 12:26:06.002: ERROR/AndroidRuntime(1776): FATAL EXCEPT

  • ios Upload Image and Text using HTTP POST 2011-12-19

    Thanks for reading. I am new to iOS and I am trying to upload an Image and a text using multi-part form encoding in iOS. The curl equivalent is something like this: curl -F "param1=value1" -F "[email protected]" "http://some.ip.address:5000/uploa

Copyright (C), All Rights Reserved.

processed in 0.195 (s). 11 q(s)