Tag: android-layout

Difference between Frame and Relative layout?

I’m new to android programming but from how much I have understood of the layouts from the documentation, RelativeLayout is mostly used when you need the views based on some rules and the FrameLayout when you want to overlap views. But unfortunately for the following program I get the work of FrameLayout done by using […]

LinearLayout with two children of equal width

I’m having some issues getting two children of a LinearLayout to have the same width. This is what I am getting: And here is my layout xml for the grey box: <LinearLayout android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:orientation=”horizontal” android:weightSum=”2″ android:background=”@color/medium_grey” > <ImageView android:id=”@+id/profile_photo” android:layout_width=”0dp” android:layout_height=”wrap_content” android:src=”@drawable/placeholder_profile_photo” android:scaleType=”fitCenter” android:contentDescription=”@string/blank” android:layout_weight=”1″ /> <LinearLayout android:layout_width=”0dp” android:layout_height=”wrap_content” android:orientation=”vertical” android:gravity=”center” android:layout_weight=”1″ android:layout_gravity=”center_vertical” android:background=”@color/alert” […]

Align-Center SlidingTabLayout

After I moved my app to 5.0, I had to move from the basic tabs to the slidingTabLayout that a google developer provides . The problem is, I can’t figure out how to center both buttons in a way that they get both centered like the old one. Btw, I’m not talking about the style, […]

Expandable listview inside scrollview

I have few contents follwed by Expandable listview.I am not able to scroll the entire layout. I have been searching for appropriate answer more than a week..Suggest some answers.

How does PocketCasts do this transition/effect?

PocketCasts material update has an awesome transition animation for their list items onClick. Is this done by adding a view/fragment to the existing Coordinator Layout for the activity? Any ideas on how I can implement this?

using both setOnItemClickListener and setOnItemLongClickListener both listener fired same time or works same time.Why

In ListView I am using both setOnItemClickListener() and setOnItemLongClickListener(). When I click on an item it works fine but when I long-click on an item sometimes both listeners are fired at same time or work at same time. Why? /** * on click of list view item show the run time webview. */ mListViewStar.setOnItemClickListener(new OnItemClickListener() […]

how to make a relative layout scrollable when it has many children views?

my xml goes as shown below <?xml version=”1.0″ encoding=”utf-8″?> <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/form_layout” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:background=”@color/black” android:orientation=”vertical” android:overScrollMode=”ifContentScrolls” android:scrollbarStyle=”insideOverlay” android:scrollbars=”vertical” > <Spinner android:id=”@+id/formulae” android:layout_width=”200dp” android:layout_height=”60dp” android:layout_marginLeft=”50dp” android:layout_marginRight=”50dp” android:background=”@color/LightSkyBlue” android:dropDownWidth=”wrap_content” android:entries=”@array/formulas” android:gravity=”center” android:paddingLeft=”0dp” android:textAlignment=”center” /> <EditText android:id=”@+id/k2_editText” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_above=”@+id/al” android:layout_alignRight=”@+id/al_editText” android:layout_alignTop=”@+id/k2″ android:layout_marginLeft=”120dp” android:ems=”10″ android:enabled=”true” android:inputType=”numberDecimal” android:onClick=”@drawable/textfield_activated_holo_light” android:textColor=”@color/White” android:textSize=”15sp” android:visibility=”visible” android:width=”100dp” /> <TextView android:id=”@+id/k1″ android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_alignParentLeft=”true” […]

How can I remove all default padding from EditText?

I am using an EditText and it always adds a bit of padding in my text to both left and right. Adding android:includeFontPadding=”false” did not help and using negative android:layout_marginLeft or android:layout_marginRight just makes the EditText “expand”. How can I strip all padding from the EditText that is being added by default? <EditText android:layout_width=”match_parent” android:layout_height=”wrap_content” […]

Rendering Problems Exception raised during rendering: color and position arrays must be of equal length

Hello i’m getting rendering errors in Android studio. Does someone know why this is caused? My xml: <!– ListRow Left side Thumbnail image –> <LinearLayout android:id=”@+id/thumbnail” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_alignParentLeft=”true” android:layout_marginRight=”5dip” android:background=”@drawable/image_bg” android:padding=”0dip” > <ImageView android:id=”@+id/list_image” android:layout_width=”50dip” android:layout_height=”50dip” android:scaleType=”centerCrop” /> </LinearLayout> <TextView android:id=”@+id/title” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_alignTop=”@+id/thumbnail” android:layout_marginTop=”0dip” android:layout_toRightOf=”@+id/thumbnail” android:text=”De Titel van het geweldige bericht” android:textColor=”#60a926″ android:textSize=”15dip” […]

place 2 radio buttons next to each other (on one 'line') in a vertical layout

i have my controls in a vertical LinearLayout. All my controls are place below each other. What i want to do is place a radio group (with 2 radio buttons) on one ‘line’ How can i do that? I tried wrapping it in a horizontal LinearLayout, but that didn’t work out

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