Tag: xml

Android XML values – String Array :: Placing a quote in the value?

I have a string array in strings.xml, in the values I need to have shutter speeds. For example: 3″2 or 0″8 I try to enter the data in the xml, but that does not work. Alternatively; when I enter the value in the graphical interface of the strings.xml file, it places the data as Which […]

How to change ImageView source in android

This is my xml, this is located on a fragment that appears in my activity. <FrameLayout android:id=”@+id/frame1″ android:layout_width=”wrap_content” android:layout_height=”115dp” android:layout_margin=”2dp” android:layout_weight=”0.33″> <ImageView android:id=”@+id/whoamiwith” android:layout_width=”match_parent” android:layout_height=”match_parent” android:scaleType=”fitCenter” android:src=”@drawable/default_image” /> </FrameLayout> And this is my java code : @Override public void onClick(View click) { if (click == profileBtn) { whoamiwith.setBackgroundResource(R.drawable.image_i_wanna_put); } } I am trying to change […]

How to change direction of android elevation shadow?

I have FrameLayout with android:elevation=”4dp”. Shadow of this elevation directed down. I want change direction of shadow to up. <FrameLayout android:id=”@+id/container” android:layout_width=”match_parent” android:layout_height=”100dp” android:elevation=”10dp” android:layout_marginBottom=”100dp” android:background=”@color/ColorPrimary” android:layout_alignParentBottom=”true” android:layout_alignParentLeft=”true” android:layout_alignParentStart=”true”> </FrameLayout>

How to underline text of button in Android?

I am new in android programming.I am developing a simple app . I have a button which is transparent and has an icon and text. I want to underline the text of the button but i have not been able to do this. Below is my xml code: <Button android:id=”@+id/park” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:drawableLeft=”@drawable/park” android:text=”@string/button_name” android:background=”#00000000″ […]

How to check which current image resource is attached to ImageView in android xml?

I want to check which image resource is attached to ImageView in xml, I am able to check that which image resource is attached to image view but my requirement is to how to check that the ImageView has the same resource which I have set into xml or not, based on that I need […]

Why do I get white space on top and on the bottom of my ImageView in my RelativeLayout?

I am using a relativelayout to overlay to images. On all screen sizes so far that I have tested (from 2.7 to 10.1 inch) I always get white space on top of my image. In my IDE I always see that my relativelayout is causing the extra space on top and on the bottom of […]

Android arrange layout with height in percentage

I am very new to android and practicing. I am trying to design a screen. With will contain a background image and a floating container with sliding menus. ( For more details please find the attached image ) My layout consists of a background image, a container with some icons will float at the bottom, […]

How to set XML fullscreen in Android

How do I create a full screen mode in XML irregardless of how small what contents are in it? Here’s my “show.xml” code: <LinearLayout android:orientation=”vertical” android:layout_height=”wrap_content” android:layout_width=”fill_parent” android:layout_gravity=”center”> <Button android:id=”@+id/ok_btn” android:layout_height=”fill_parent” android:layout_width=”fill_parent” android:typeface=”sans” android:text=”ok”></Button> </LinearLayout> I want to display it like another full screen page, with black background, like a main.xml. In this case, its […]

Convert XML to JSON object in Android

I have an XML string as shown below: <s:Envelope xmlns:s=”http://schemas.xmlsoap.org/soap/envelope/”><s:Body><Response xmlns=”http://tempuri.org/”><UserResult><Users xmlns=””><User> <Message>Success</Message> <UserId>213213213</UserId> <FullName>Abc</FullName> <Roles> <Role> <RoleId>23232333</RoleId> <RoleName>Salesperson</RoleName> </Role> </Roles> </User> </Users> </UserResult></Response> </s:Body> </s:Envelope> Is it possible to convert XML to JSON?

Android TextView SingleLine field hides long text

I have a TextView which sits on the left side of the screen and is set with gravity=”right” and it is set with SingleLine = “true.” If by some chance the text in this view gets too long I want it to simply disappear off the left hand side of the view. I thought the […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.