Tag: android-layout

RelativeLayout – CenterInParent and marginTop

I has the following XML: <RelativeLayout android:id=”@+id/cover_box” android:layout_width=”wrap_content” android:layout_height=”wrap_content”> <ImageView android:id=”@+id/cover” android:layout_width=”wrap_content” android:layout_height=”wrap_content” /> <ImageView android:id=”@+id/download” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:src=”@drawable/mark_download” android:layout_centerInParent=”true” android:layout_marginTop=”90px” /> </RelativeLayout> But it’s look’s like the marginTop is being ignored.

StateListDrawable to switch colorfilters

I want to create custom buttons to use in a TabHost. I haven been trying to just use the same image resource (png), but have the colorfilter change depending on the state. So I made this bit to serve as the layout for the custom button: <?xml version=”1.0″ encoding=”utf-8″?> <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”fill_parent” android:layout_height=”fill_parent”> <ImageView android:id=”@+id/tab_icon” […]

Clear SingleChoice ListView selection

Is there a way to clear the selected item in a ListView? The ListView is defined like this: <ListView android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:minHeight=”50dp” android:id=”@+id/example_list” android:layout_weight=”2″ android:choiceMode=”singleChoice”/> And is filled using a custom Adapter. The selected item is highlighted using a Selector: <?xml version=”1.0″ encoding=”utf-8″?> <selector xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:state_pressed=”true” > <shape> <gradient android:startColor=”#3E5260″ android:endColor=”#3E5260″ android:angle=”270″ /> </shape> […]

Device Check (Samsung vs Others)

I am working on an application, where there is some code implementation difference for samsung and htc, kindly have a look at my SO question Sending SMS to multiple recepients (Samsung vs HTC) How can I put a check for if the device is samsung or others(htc)

How to scroll horizontal RecyclerView programmatically?

I have a horizontal RecyclerView and two button (Next,Previous) as shown in the image below. so i need to move to the next item or position by use these buttons , i know about method called scrollTo but i don’t know how does it work

How to set focus to right of text in EditText for android?

In my application when users click or touch on the Edit Text view the focus is sometimes set to the beginning. For example if the existing text is “Hi”. Users wants to click on it and change it to “H1 How are you?” by adding the text “How are you?”. But since the focus is […]

How to make listFooter not clickable

So this is the deal, I have tried looking at other threads like this one here https://stackoverflow.com/questions/12479909/how-to-make-list-header-and-footer-not-click-able But it doesn’t work. I can’t manage to “do nothing on click”. But the problem is not to handle what hapens when the list is clicked, that is that the list is giving feedback as if its been […]

Can't compress a recycled bitmap

I’m trying to save a Layout into an Image in the SDCard but I get this error. I tried several codes I found in this forum but all of them have the same compress call that is giving the error. This is the code I use for saving the image: private Bitmap TakeImage(View v) { […]

Android ViewPager performance issues when using background

I’ve got an Activity made by XML, I’ve set it’s background to a background image I have in my drawable folder. In the same activity I’ve created a ViewPager to allow swiping back and forth between views. All the views inside the ViewPager contain one image. Whenever I swipe left or right, the transition is […]

How to create User interface like the attached photo

Can any one tell me what is this photo effect called. And I would like to know how to create an adapter for this attached image effect. @Edited: This is a sample photo of Android market. I want to create a layout like this. I suppose this should be made overriding a GridView adapter. Portrait […]

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