Tag: layout

How to programmatically add multiple LinearLayouts into one view and then add to ViewFlipper?

I hope question title gives you a good description of the problem. I want to create this XML, but programatically (please don’t suggest not doing it programmatically ^_^ ) <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:orientation=”vertical” android:padding=”10dip” android:layout_width=”fill_parent” android:layout_height=”fill_parent”> <TextView android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:layout_marginBottom=”10dip” android:text=”Messages:”/> <EditText android:id=”@+id/messageHistory” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:clickable=”false” android:layout_weight=”1″ android:editable=”false” android:gravity=”top” android:scrollbars=”vertical” android:scrollbarSize=”10px” /> <LinearLayout android:orientation=”horizontal” android:layout_width=”fill_parent” android:layout_height=”fill_parent” […]

Measure height of TextInputLayout error container

Hi I have to make layout as below, edit text has to be in TextInputLayout to have error and floating hint functionality, and spinner on the right must have underline. My question is how to do it, because when I’m adding EditText into TextInputLayout there is a padding bellow and both underlines aren’t in the […]

How to create layout-small-land folder?

I want to create separate folders for my layouts, like this in my resource directory: layout-land layout-port this is ok, but this: layout-small-land layout-small-port or layout-land-small layout-port-small Results in: ‘Invalid resource directory name’ What gives?

Navigation drawer with curverd edge in android

I have done different Navigation Drawer types like Permanent,Persistent Mini variant,Temporary. All of them are rectangle in their outline shape like below. Requirement: I want to create a Navigation Drawer with a curved edge(in its right side). Let’s have a look on my nav. view <android.support.design.widget.NavigationView android:background=”#FFF” android:id=”@+id/nav_view” android:layout_width=”wrap_content” android:layout_height=”match_parent” android:layout_gravity=”start” android:fitsSystemWindows=”true” app:headerLayout=”@layout/nav_header_main” app:menu=”@menu/activity_main_drawer”/> It […]

Simple swipe gesture to activity tutorial?

im looking for a turoial with source code on swipe gesutes, I dont want a view pager, I want a swipe gesture tutorial. here is one example I found but doesnt work for me http://www.eridem.net/android-tip-010-left-and-right-swipe-gesture-events I would like something like this, thanks Please no view pagers

TextInputLayout setErrorEnabled doesn't create new TextView object

I’ve found an issue while creating a login form. I show some errors on my TextInputLayout and disable them, when the user filled in something correctly. I set it with mTextInputLayout.setError(“This field is required”); and disable it with mTextInputLayout.setError(null); Problem is that there are still paddings of the empty TextView object, which was showing the […]

How do I determine how much text will fit in a TextView in Android?

I have a layout that looks something like this: [TextView 1] [TextView 2] [ TextView 2 spill-over ] Essentially, I need the contents of TextView 2 to wrap to the next line, but start where TextView 1 starts. I was thinking that if I knew how much text would fit into TextView 2 before it […]

Android layouts and automatic image resizing

My android app currently has two layouts for its splash screen, portrait and landscape. Both use the same simple format – an image that’s the same size as the screen, held in a simple linear layout: <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:orientation=”vertical” android:layout_width=”fill_parent” android:layout_height=”fill_parent” > <ImageView android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:scaleType=”fitCenter” android:src=”@drawable/splash_p” /> </LinearLayout> The image used […]

Android ActionBar custom layout styling

I’m just starting android development coming from IOS and again stubbled onto a problem. And after 1 day of trying i decided that i will ask the people of stack overflow. So my problem: I have an app and in the action bar (default no sherlock) i want 1 logo and 2 lines of text. […]

Building/using runtime generated layout XML in Android

I am currently working on a project which requires me to use an XML document to render a form on an Android device. The form must be fetched and displayed at run-time. I am wondering if there is a way to tag the form XML, transform it using XSLT into an Android layout XML, and […]

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