Tag: android-layout

Clipped button doesn't receive touch input

I have a FAB that resides in between two layouts. Using negative margin alongside with android:clipChildren and android:clipToPadding both set to false I’m able to produce this pleasantly placed little button: Now, the problem is that the bottom half of the FAB isn’t receiving touch input or in other word: not clickable. I’ve tried playing […]

ViewPager swipe doesn't work with RecyclerView

I want to implement a simple swipe navigation using a ViewPager with fragments that hold and manage a RecyclerView. The Fragments are created and can be switched using setCurrentItem(), but you cannot swipe left or right to switch pages. The ViewPager seems to ignore any swipe gesture. My Activity layout: <FrameLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” android:layout_width=”match_parent” android:layout_height=”match_parent”> […]

How is the number of views limited?

I want to figure out the main effectivity issues of the Android layouts and views. I’m doing a research now but maybe somebody has answers already. I have a RelativeLayout that is populated with views dynamically. Basically, the application loads a forum thread in XML and then renders the discussion tree so each message is […]

Android ADT 21.0.0. Memory leaks in graphical layout

I’m running ADT 21.0.0.v201210310015-519525 on eclipse 4.2.1 and each time I start working on graphical layout eclipse slowly starts to get unresponsive. After opening ~5 files like this it is practically unusable and need to restart. Anyone else got these issues? I’ve set my .ini in eclipse to increased memory and java 1.6 like mentioned […]

Android Floating Action Button options Menu

There are lots of custom libraries for achieving the FAB menu thing. But I want it to be done without using any custom libraries. I want to achieve this FAB Menu natively. Please don’t suggest me any custom library

Creating Compound Controls With Custom XML Attributes

I’m been trying to combine a TextView and an EditText into one compound control which uses custom xml elements to pass in default values for each individual element. I’ve been looking at the tutorials/docs here: Building Compound Controls Passing Custom Attributes What I have so far. Attrs.xml: <?xml version=”1.0″ encoding=”utf-8″?> <resources> <declare-styleable name=”FreeText”> <attr name=”label” […]

Android – Creating a circular mask on video

I’m relatively new to Android development, and I was wondering if it’s possible to mask a VideoView into a shape. This is what I have so far: Expected Result My XML for video view and layout: <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:background=”#0088ff” android:paddingBottom=”@dimen/activity_vertical_margin” android:paddingLeft=”@dimen/activity_horizontal_margin” android:paddingRight=”@dimen/activity_horizontal_margin” android:paddingTop=”@dimen/activity_vertical_margin” tools:context=”.VideoPlayerActivity” > <FrameLayout android:layout_width=”250dp” android:layout_height=”250dp” android:layout_centerHorizontal=”true” android:layout_centerVertical=”true” android:background=”@drawable/circular_mask” android:foreground=”@drawable/circular_mask” […]

Badge notification over drawer toggle in toolbar – Android

I want to notify user about new unread message in the app which is accessible through navigation drawer. I was thinking about notification badge something similar Apple have but over drawer toggle in toolbar. This is what I have now: This is what I want: How can I achieve that?

Create a selector of styles

I would like to create an xml selector of styles. Basically i would do something like that: <selector xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:state_pressed=”true” style=”@style/filter_btn”/> <item android:state_pressed=”false” style=”@style/transparent” /> </selector> Could someone help me ?

ImageButton with different states images size

How can I prevent an ImageButton from having a fixed size? The drawables used in the selector have different size, and I want the ImageButton to resize itself to match the image size. I’ve tried adjustViewBounds without success. <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:padding=”8dp” > <ImageButton android:id=”@+id/picture_imagebutton” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:adjustViewBounds=”true” android:src=”@drawable/tab_background_selector” /> </RelativeLayout>

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