android-xml

Elements in Relative Layout showing differently when the app runs

笑着哭i 提交于 2019-12-06 12:06:26
I have a ListView created inside a fragment, and it has a search filter, the problem is XML layout showing fine in android studio but when running in the emulator or phone it's showing differently (not properly as I aligned) and also when I click the SearchView it goes under the tab navigation. Can anyone tell how to fix this? This is the fragment: import android.content.Context; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView;

Android place an image view between two views

拈花ヽ惹草 提交于 2019-12-06 11:07:25
I need to create a layout as shown in the image. The rounded button with the arrow needs to be exactly between the blue and the gray background. I'm having difficulties placing it without specifying the margins precisely, which is something I don't want to do because there is no guarantee it will look good on all resolutions and devices. I would appreciate an xml sample for that Thanks! Use the desired drawable.. hope it works.. you can set width and height according to your need. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

Connection between View in the xml file and extened View class

浪子不回头ぞ 提交于 2019-12-06 09:45:13
问题 Is there a way to link inherit class to xml file. I am trying to connect extended class to widget in the xml file. Is it possible ? Thanks in advance. 回答1: You must have noticed that all the nodes that we specify in the layout XMLs are actually either View classes(for e.g: TextView, EditView) or view containers/layout managers(e.g: LinearLayout, RelativeLayout etc.). Android allows you to create custom views and containers by extending the View class and one of the layout managers,

ANDROID Rendering problems NullException

∥☆過路亽.° 提交于 2019-12-06 05:28:27
I am a newbie in android programming. I tried to create a stopwatch application, but recently i got an error in the layout. I have been debugging this layout error for 2 days and still cannot find the solution. I do not think this is IDE problem because when i tested it using my phone, the program stopped(error). Please take a look of the error below: java.lang.NullPointerException at android.widget.LinearLayout.forceUniformHeight(LinearLayout.java:1380) at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:1368) at android.widget.TableRow.onMeasure(TableRow.java:114) at android

Can't remove overlay view

百般思念 提交于 2019-12-06 05:02:54
问题 Update I was able to fix this, The problem was dialogs and related could be initiated from broadcast receiver but not recommended, as the activity running ends before the view. Trying to implement overlay like fb messenger, truecaller etc. public class IncomingCall extends BroadcastReceiver { private Context pcontext; private static final String TAG = "CustomBroadcastReceiver"; TelephonyManager telephony; CustomPhoneStateListener customPhoneListener ; @Override public void onReceive(Context

Reference attribute enum value

断了今生、忘了曾经 提交于 2019-12-06 04:35:26
问题 Is it possible to reference an enum value when supplying style parameters? For example, we can do: <!-- layouts.xml --> <TextView android:text="@string/str" /> <!-- values.xml --> <item type="string" name="str">hi</item> This works fine with strings, integers, dimensions and so on but I need to reference an enum value - for example the visibility attribute. I'm looking for something like: <!-- layouts.xml --> <TextView android:visibility="@????/viz" /> <!-- values.xml --> <item type="?????"

Android - Seemingly harmless layout causes app to crash after short use without any errors

*爱你&永不变心* 提交于 2019-12-06 03:55:25
After 2 days of fruitless testing, I've decided to post my issue here, in the hopes that I'm missing something obvious. I've boiled down a seemingly innocuous xml-layout to a random collection of images, layouts, and a scrollview. Here it is: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/wood_texture" tools:context="com.testlayout.example.testlayout.MainActivity"> <ImageView

Android parse Plist file

蓝咒 提交于 2019-12-05 21:51:39
问题 Hello Im trying to parse an plist file that contains array of dict's. Im trying to do this using xmlwise. The content of the plistfile is here So far I only have this in my activity and im getting the content of the plistfile, but how to parse the content into an arraylist? Map<String, Object> properties = null; try { InputStream inputStream = getResources().openRawResource(R.raw.first_5); BufferedReader br = null; try { br = new BufferedReader(new InputStreamReader(inputStream));

Align textview according to the language selection (LEFT -RIGHT)

喜夏-厌秋 提交于 2019-12-05 17:38:30
i have a linear layout , which contains a textView and EditText arranged horizontally.i have an option for selecting language in prvious activity (english and arabic). when i select english the current alignment is fine but when i select Arabic it should show right to left that means the textView position should go to right (in layout it will start from left) after that the editText. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="

Difference between android:id, android:name and name tags in Android XML files

99封情书 提交于 2019-12-05 16:49:12
问题 Can someone clarify the difference between android:id , android:name and name tags in Android's XML files. They all seem to be ways to reference things. For example, when I have a string array in the res/values/array.xml file I access using the name field in the defined array yet the Javadoc refers to this as the "ID". android:id seems to be just used in View s ? Am I missing something or would it not be simpler to have one tag? 回答1: No, I don't believe you're missing anything. Although these