android-inflate

Displaying multiple xml views w/o fragments

北战南征 提交于 2019-12-11 05:35:51
问题 In my app the user spins a carousel. On the selected Item I need to display a separate xml view for each item. The carousel is visibile at all time at the bottom with the view visible in the top half. I think that there is a better way than to use fragments. Any ideas? The following code is not functional as of now but I think an inflator may be the way to go but to get it done is troubling me. After case0 there is case1-case5. carousel.setOnItemSelectedListener(new OnItemSelectedListener(){

Error inflating class <unknown> which I know is a webview

无人久伴 提交于 2019-12-11 05:14:22
问题 I need help, I have an application published on the market using a webview to present information.. Every now and then i get error reports like this one: http://pastebin.com/zQ16Sf2z The error points to my inflation-line of my activity: setContentView(R.layout.view); Binary XML file line #22: Error inflating class <unknown> must mean <WebView android:id="@+id/WebView" android:layout_width="fill_parent" android:layout_height="fill_parent"></WebView> in my layout http://pastebin.com/MFAPawin

ExpandableView inside another ExpandableView won't inflate children

爷,独闯天下 提交于 2019-12-11 04:28:37
问题 I've been struggling for a couple of weeks to solve this problem. I have two expandable views, one inside another. Whenever i click on the second level expandable view items, it won't inflate its children. All i see when i click is a small scroll bar that appears on the right side on the expandable view item itself. Using a simple layout with a fixed textview results in the same behaviour, meaning that the problem isn't within the ShiftListItem object/s. Also, getChildView() is never been

Inflate into “this”?

本小妞迷上赌 提交于 2019-12-10 23:33:33
问题 I've been creating apps without much XML, creating views programmatically. I'd like to switch to XML. So I wrote an XML file for a RelativeLayout, and I need to inflate it into an existing class (a subclass of RelativeLayout, of course) that has all the implementation logic. How do I inflate into "this" in the constructor? By the way, what's really the advantage of XML? When I create views in the code, I scale fonts and images and also move views around depending on the screen's size,

How to set a typeface to menu items in overflow menu on toolbar

牧云@^-^@ 提交于 2019-12-10 22:13:34
问题 I want to change the default typeface of the items of the overflow menu and set a custom typeface . I tried adding a Factory to the LayoutInflater and within the onCreateView() method I changed the TextView's typeface . But it didn't work. Here is the code(Inside onCreateOptionsMenu), getLayoutInflater().cloneInContext(this).setFactory(new LayoutInflater.Factory() { @Override public View onCreateView(String name, Context context, AttributeSet attrs) { if (name.contains("com.android.internal

Android: Error inflating class PreferenceScreen

喜夏-厌秋 提交于 2019-12-10 10:48:11
问题 Please help me out here, I'm hitting brick wall for the last two days and can't figure it out. I have a simple PreferenceFragment and would like to inflate it from an Activity. Here is the res/xml/preferences.xml: <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" android:key="preferences"> <PreferenceCategory android:title="@string/notification_basic" android:key="notification"> <CheckBoxPreference android:key="enable_notification" android:summary="@string/enable

How to inflate multiple instances of a layout with the same id inside an inflated layout

可紊 提交于 2019-12-09 08:09:25
问题 I have a LinearLayout with many nested LinearLayouts and TextViewss My main activity inflates the main LinearLayout, Then I load data from a server and based on the data received, I add multiple Layouts in a place holder (LinearLayout) This is simple a news page where I load Images associated with the news and place it inside an initially empty LinearLayout. Each Image has the following info: Title(TextView), Date(TextView), Image(ImageView) so what I actually do is the following: * Please

Android + ListFragment with a custom view hierarchy

最后都变了- 提交于 2019-12-09 08:03:04
问题 I'm attempting to customize the fragment layout by returning my own view hierarchy from onCreateView(LayoutInflater, ViewGroup, Bundle) . This inflates my custom view, but seems to stack the views instead of inflating within, I see everything at once. Any help is appreciated. MyActivity.java: public class MyActivity extends FragmentActivity{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getSupportFragmentManager().findFragmentById(android

Android floating view across activities

穿精又带淫゛_ 提交于 2019-12-07 03:53:54
问题 Requirement I have an application with 2 activities, say A and B , with navigations like A->B and B->A (on back press). My requirement is I want a view/layout floating on screen, irrespective of which activity is currently visible. I inflate this view on app start(onCreate of activity A), it remains static on screen during the transition from A->B and when B is onscreen. So naturally this view should be inflated only once (when app starts, onCreate of A). What I found out I did some searching

Android: Error inflating class PreferenceScreen

限于喜欢 提交于 2019-12-06 09:44:37
Please help me out here, I'm hitting brick wall for the last two days and can't figure it out. I have a simple PreferenceFragment and would like to inflate it from an Activity. Here is the res/xml/preferences.xml: <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" android:key="preferences"> <PreferenceCategory android:title="@string/notification_basic" android:key="notification"> <CheckBoxPreference android:key="enable_notification" android:summary="@string/enable_notification" android:title="@string/notification_title" android:defaultValue="false"> <