layout-inflater

android dynamically add layouts under each other

谁说胖子不能爱 提交于 2019-12-19 04:15:18
问题 I'm trying to add multiple layouts dynamically under each other. So I wrote the following code: for (int i = 1; i <= layoutCounter; i++) { View neu = inflater.inflate(R.layout.vote, parent, false); neu.setId(layoutID); if (layoutID == 1) { params = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); params.addRule(RelativeLayout.BELOW, R.id.txtMultiline); } else { params = new RelativeLayout.LayoutParams( RelativeLayout

How to inflate a layout dynamically?

怎甘沉沦 提交于 2019-12-19 03:14:30
问题 I have the following layout defined in XML: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/streamRelativeLayout"> <ListView android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/streamListView"></ListView> <ProgressBar android:layout_centerInParent="true" android:layout_height="wrap_content" android:id="@

How to inflate a layout dynamically?

巧了我就是萌 提交于 2019-12-19 03:14:06
问题 I have the following layout defined in XML: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/streamRelativeLayout"> <ListView android:layout_height="fill_parent" android:layout_width="fill_parent" android:id="@+id/streamListView"></ListView> <ProgressBar android:layout_centerInParent="true" android:layout_height="wrap_content" android:id="@

Android force Fragment to rebuild View

我与影子孤独终老i 提交于 2019-12-18 19:08:18
问题 I have a simple app that has two fragments and when in landscape mode, both fragments are shown side by side and in portrait I show Fragment A and then if they select an option, start an Activity that shows Fragment B. My problem is when I am in Portrait mode and showing Fragment B, if the user selects a menu option I want to refresh or redraw the View that is associated with Fragment B and can’t understand how to make this work. I tried the getView method and getLayoutInflater method but the

Plugins architecture for an Android app? [closed]

一世执手 提交于 2019-12-17 17:28:30
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . THIS QUESTION HAS MOVED TO https://softwarerecs.stackexchange.com/questions/27841/plugins-architecture-for-an-android-app I want to implement a plugin system for an Open Source app, because it has become really large, with many features that only a few users need. Releasing different apps is not a good solution,

Different text for each image in image viewpager

不打扰是莪最后的温柔 提交于 2019-12-17 16:49:42
问题 I used viewpager class to display sets of images instead of gallery class as its deprecated and customized it to show the text by using the below code , the problem is the same text showed for all images , what im trying to get is : Different text for each image , which explain it , lets say we have 5 images , it must has 5 different text each one describe its image . any advice will be appreciated , thanks The code: ImagePager public class ImagePager extends Activity { @Override public void

Drag and Drop icons to Home Screen

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-17 14:44:57
问题 Update: to understand my question, here is what i need to achieve: Drag icon from App drawer to home screen ( if possible not in a gridview) like in the pic, Old (this just to learn how this works): I'm trying to implement dragging clickable icons from a ListView to a customView with no container( Listview or Gridview... ) inside the same Activity or another, here is a picture for you to understand more: but when i put the icon in the right area i don't see the object , in the log i see: I

Change background color of android menu [duplicate]

人盡茶涼 提交于 2019-12-17 05:04:34
问题 This question already has answers here : Android: customize application's menu (e.g background color) (6 answers) Closed 6 years ago . I'm trying to change the standard light grey to a light green. Seems that there is not a simple way to do this (through Android Themes, for example) but I have found a workaround as explained at this page: http://tinyurl.com/342dgn3. The author seems disappeared, can someone help me integrating this code? I don't understand where I need to implement the

Problem inflating custom view for AlertDialog in DialogFragment

拟墨画扇 提交于 2019-12-17 04:28:19
问题 I'm trying to create a DialogFragment using a custom view in an AlertDialog . This view must be inflated from xml. In my DialogFragment class I have: @Override public Dialog onCreateDialog(Bundle savedInstanceState) { return new AlertDialog.Builder(getActivity()) .setTitle("Title") .setView(getActivity().getLayoutInflater().inflate(R.layout.dialog, null)) .setPositiveButton(android.R.string.ok, this) .setNegativeButton(android.R.string.cancel, null) .create(); } I have tried other inflation

Problem inflating custom view for AlertDialog in DialogFragment

不羁的心 提交于 2019-12-17 04:28:13
问题 I'm trying to create a DialogFragment using a custom view in an AlertDialog . This view must be inflated from xml. In my DialogFragment class I have: @Override public Dialog onCreateDialog(Bundle savedInstanceState) { return new AlertDialog.Builder(getActivity()) .setTitle("Title") .setView(getActivity().getLayoutInflater().inflate(R.layout.dialog, null)) .setPositiveButton(android.R.string.ok, this) .setNegativeButton(android.R.string.cancel, null) .create(); } I have tried other inflation