android-xml

Android XML Layout for all Devices (Small/Normal/Large/XLarge, etc)

泪湿孤枕 提交于 2019-12-29 13:31:32
问题 I want to create a XML Layout that will support all the Screen sizes. In the XML, first element is ImageView , second one is TextView and third one is Button with an Image. So the TextView should be the exact position in all the devices (small, medium, large, xLarge, etc). How can I do this? Here is the XML output should be look like: Here is the XML file that i created for the Normal/Medium Layout: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android

ActionBarSherlock: changing homeAsUpIndicator doesn't work

南楼画角 提交于 2019-12-29 00:51:09
问题 I'm want to change the up icon with applying the following style to my activity, but it doesn't work and but I still get the default black '<' icon. Can anyone find out what is missing here? <style name="AppTheme.ActionBar" parent="@style/Theme.Sherlock.Light"> <item name="actionBarStyle">@style/actionBarStyle</item> <item name="android:actionBarStyle">@style/actionBarStyle</item> </style> <style name="actionBarStyle" parent="@style/Widget.Sherlock.Light.ActionBar.Solid"> <item name="android

ActionBarSherlock: changing homeAsUpIndicator doesn't work

不打扰是莪最后的温柔 提交于 2019-12-29 00:49:05
问题 I'm want to change the up icon with applying the following style to my activity, but it doesn't work and but I still get the default black '<' icon. Can anyone find out what is missing here? <style name="AppTheme.ActionBar" parent="@style/Theme.Sherlock.Light"> <item name="actionBarStyle">@style/actionBarStyle</item> <item name="android:actionBarStyle">@style/actionBarStyle</item> </style> <style name="actionBarStyle" parent="@style/Widget.Sherlock.Light.ActionBar.Solid"> <item name="android

Android: Placing ImageView on overlap between layouts

拟墨画扇 提交于 2019-12-28 05:35:11
问题 I am trying to place an ImageView on the overlap point between two layouts. In the picture below, my goal would be to place the ImageView where the white square is. NOTE: The overlap point will not necessarily be centered vertically as shown below Is this possible in XML? My only guess right now is to do this in the actual code itself. EDIT 8/3/2016: For reference, I think ConstraintLayouts may be the best future solution for these types of problems http://tools.android.com/tech-docs/layout

error: Error parsing XML: not well-formed (invalid token) …?

陌路散爱 提交于 2019-12-28 03:40:48
问题 I am working on an application, with following XML. but whenI try to clean/build my project the following error occurs: "error: Error parsing XML: not well-formed (invalid token)" <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="

How to inserting a custom view in XML in Android

拥有回忆 提交于 2019-12-25 18:20:01
问题 I have a class A that extends class View . I have a class B that extends class A . Now I'm trying to add class B into my xml however I'm unable to do that whereas I'm able to add class A into my xml. One more thing which I've noticed is that all other custom classes which directly extends View are visible inside my xml. I wanna know whether is there any way of adding a class which extends another class which in turn extends View into my xml? NOTE : I'm using proper xml format and complete

Why is my floating action button not displaying properly?

早过忘川 提交于 2019-12-25 08:23:47
问题 My floating button image looks like this It's a smaller button inside a larger circle, How do I fix this? layout file: <android.support.design.widget.FloatingActionButton android:id="@+id/addToKitchenButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="16dp" android:layout_gravity="bottom|end" android:layout_alignParentBottom="true" android:layout_alignParentEnd="true" android:src="@drawable/ic_add_circle_black_50dp" /> vector code: <vector

App crashes when I open another activity

陌路散爱 提交于 2019-12-25 04:46:13
问题 So I am creating an app with 5 activities that have 5 separate soundBoards in which are controlled by 5 separate soundPools. I am also using a navigational drawer on each activity. When I run the app it can open the first two activities but whenever I call the third to open the app stops working. On the memory monitor the memory usage peaks to 64MB and then it crashes. Is it just the emulator is limited to 64MB and that it will work fine on a phone or do I have a memory leak somewhere? Do I

Unable to retrieve string from EditText

眉间皱痕 提交于 2019-12-25 03:32:35
问题 Im trying to figure out why I am unable to get a valid string from two edittexts The following lines are what I am talking about String newPin = etNewPassword.getText().toString(); String conPin = etConfirmPassword.getText().toString(); Below is the entire file public class PasswordDialogPreference extends DialogPreference { TextView tvOldPassword; TextView tvNewPassword; TextView tvConfirmPassword; EditText etOldPassword; EditText etNewPassword; EditText etConfirmPassword; SharedPreferences

Writing to an existing resource XML file in Android

那年仲夏 提交于 2019-12-25 03:28:12
问题 I am trying to write to an existing XML file in the /res/xml directory on an Android device. Two questions: 1) Are these files able to be overwritten? 2) If so, how can I obtain a handle to that file? I am trying this to no avail: FileOutputStream fos; try { fos = openFileOutput("/res/xml/scores.xml", Context.MODE_PRIVATE); fos.write(writer.toString().getBytes()); fos.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) {