Tag: android-layout

TextView ellipsize and broken symbols

I have some problem with standard android ellipsize mechanism. My textview xml layout is next: <TextView android:id=”@+id/something” android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:text=”@string/message_test_text” android:lines=”2″ android:ellipsize=”end” android:textColor=”@drawable/dialogs_text_selector” /> Then in code I’m setting Helvetica typeface to this field. And then, in the end of second line I see broken symbol after dots: Because it used in list, I see […]

Eclipse giving an error of android.support.v7.widget.GridLayout failed to instantiate

I have tried to incorporate the GridLayout from the support library, but it is not working. My target build is for API version 10. The XML code I am using is shown below: <?xml version=”1.0″ encoding=”UTF-8″?> <android.support.v7.widget.GridLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:grid=”http://schemas.android.com/apk/res-auto” android:layout_width=”match_parent” android:layout_height=”match_parent” android.support.v7.widget.columnCount=”6″ > <Button android:id=”@+id/button1″ android.support.v7.widget.layout_column=”1″ android.support.v7.widget.layout_columnSpan=”2″ android.support.v7.widget.layout_gravity=”left” android.support.v7.widget.layout_row=”1″ android:text=”Button” /> </android.support.v7.widget.GridLayout> When Eclipse tries […]

Calling Custom ListView Adapter from Fragment Class Main Activity

I’ve written a few listView activities, as a proof of concept for myself that I could do it. Now, I’m having trouble loading a listView activity into a single tab for an app with multiple tabs, that allows both swiping and tab selection for navigation. I get the error “The constructor ListView_Adapter(MainActivity.DummySectionFragment) is undefined” when […]

What is android:layout_marginStart

I would like to add some space between the left display border and an ImageView. Android SDK made me aware of “android:layout_marginStart”. Consider adding android:layout_marginStart=”10dp” to better support right-to-left layouts Why should I use android:layout_marginStart=”10dp” instead of android:layout_marginLeft=”10dp”? I have never done so and never encountered any problems with so-called “right-to-left layouts”.

how to align center a bitmap inside a canvas in android?

i have a bitmap on canvas.i need to align bitmap to centre of canvas(centre of the image should be in centre of canvas.in my requirement,there should not give fixed points to align bitmap).while portrait view how to scale canvas and image appropriate to resolution? public void onDraw(Canvas canvas) { Bitmap imgtable = BitmapFactory.decodeResource(getResources(), R.drawable.table_01); canvas.drawColor(Color.TRANSPARENT); […]

Where should I unbind ButterKnife 8.x.x in a ViewHolder?

I have a RecycleView.ViewHolder class which use ButterKnife annotations. Should my code unbind() in this ViewHolder class too? public class AView extends RecyclerView.ViewHolder { @BindView(R.id.a_text_view) TextView aText; public AView(final View view) { super(view); ButterKnife.bind(this, view); // It returns an Unbinder, but where should I call its unbind()? } } The docs (http://jakewharton.github.io/butterknife/) does not talk […]

How can I use duplicate IDs in different layouts?

I have two different layouts for two different Activities. There is a button in each of these layouts with the same id: “@+id/btnOK”. When I set a property for one of these buttons programmatically, I get a NullPointerException. But when I change one of ids, everything is okay. Is it really true that we cannot […]

Keyboard Showed messed up elements' position

I have game which require the input of touch keyboard of the mobile. Its display has problem, whenever the keyboard shows up at the text input focus, all my element which position: absolute gets all messed up. Is there a plugin that enables mobile keyboard to always show up so that I re-position all the […]

R.xml.preferences cannot be found?

I’m trying to set up some simple preferences for an Android app, but can’t get past this error: “xml cannot be resolved or is not a field.” I have cleaned, refreshed, restarted eclipse, and danced the jig – but I can’t shake the error. What am I doing wrong? The preferences.xml file: <?xml version=”1.0″ encoding=”utf-8″?> […]

R.styleable can not be resolved, why?

I have a resources.xml file located under direcotry values/ , That’s /values/resources.xml <?xml version=”1.0″ encoding=”utf-8″?> <resources> <declare-styleable name=”TheMissingTabWidget”> <attr name=”android:divider” /> </declare-styleable> </resources> In my java code, when I try to access this resource by R.styleable.TheMissingTabWidget , eclipse complain that styleable cannot be resolved or is not a field. Why? Why I can not access […]

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