Tag: layout

Sliding menu (library) always fullscreen

I’m trying to implement the sliding menu library in my app. My problem now is that I don’t seem to be able to control the width of the menu. It is always fullscreen. Can anybody tell me how to resolve this? Here is the code I’ve been playing with. SlidingMenu menu = new SlidingMenu(this); menu.setMode(SlidingMenu.LEFT); […]

Making an image circular with white circular border

How to make an image circular and give it white circular border? Is it necessary to use two image views – one for the image and other for the white border? Is there any other way to do this?

Display TextView Bottom of the Screen in Android

In my application, i want to display one TextView in Top of the Screen with screen width. next want to display graphical view below that TextView. next display one Text View below that Graphical View. I used following xml code. In my code TextView couldnt display in bottom of the screeen. <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout […]

Ellipsize is not working

I have a TextView which i set the text using setText(). In properties, I have set: Ellipsize = END Lines = 1 Gravity = Left Scroll Horizontal = False But this clips extra text (clips text since where last space is found). But do not include dots (“…”) at the end. Example: ——————————- | | […]

change order of views in linear layout android

As you know the order of views in linear layout is related to the order of them in xml file. Is it possible to change that order with java code by something like indexing?

How do I put an admob adview in the settings screen for a live wallpaper?

I’ve seen the Mario live wallpaper uses admob ads in the settings screen, but I haven’t been able to do it myself. If I put the adview into the settings.xml like you would with a normal layout I get a class cast exception. Here’s a screenshot of the mario live wallpaper to illustrate what I’m […]

How to restore Collapsing Toolbar Layout State after screen orientation change

I’ve been searching for the solution of my problem for some time and didn’t find solution. I want to restore my fragment’s layout after screen orientation change. I have Collapsing Toolbar Layout with banner image. After screen rotation my toolbar is always expanded, I want to restore it’s behavior. How can I achieve this?

Android setting LinearLayout background programmatically

I have a situation where I need to set a background on a LinearLayout programatically. In my layout, I am setting my background using `android:background=”?android:attr/activatedBackgroundIndicator”, but I want to set this programatically: <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/myLayoutId” android:layout_width=”wrap_content” android:layout_height=”fill_parent” android:gravity=”left|center” android:paddingBottom=”5dip” android:paddingLeft=”5dip” android:background=”?android:attr/activatedBackgroundIndicator” android:paddingTop=”5dip” > I’ve tried using: Drawable d = getActivity().getResources().getDrawable(android.R.attr.activatedBackgroundIndicator); rootLayout.setBackgroundDrawable(d); But it crashes. Any […]

Moving imageview with touch event

i just want a simple thing I hava a imageview and i can move it with touch This is my code, im sorry if this wrong because i just try it myself img.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View arg0, MotionEvent arg1) { // TODO Auto-generated method stub if(arg1.getAction()==MotionEvent.ACTION_DOWN) { status=StartDrag; } else if(arg1.getAction()==MotionEvent.ACTION_UP) { […]

Scrolling EditText inside ScrollView

I have a nasty problem. I have EditText(8 lines) inside ScrollView. And when I’m trying to scroll text in EditText it’s behavior is not stable. Sometimes it’s scrolling, some times it’s not taking focus. This is my layout file, to make my question more clear: <LinearLayout android:layout_width=”match_parent” android:layout_height=”wrap_content” android:orientation=”vertical” android:padding=”8dp” > <TextView android:id=”@+id/wo_task_name” android:layout_width=”wrap_content” android:layout_height=”wrap_content” […]

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