Tag: android-layout

setSystemUiVisibility(SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION) does not work

I’ve been battling with setSystemUiVisibility() to try to hide the soft navigation buttons for a while (for a video player). It does not seem to work as advertised. Here is my code, inside a visible FrameLayout. void setNavVisibility(boolean visible) { int newVis = SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; if (!visible) { newVis |= SYSTEM_UI_FLAG_LOW_PROFILE | SYSTEM_UI_FLAG_HIDE_NAVIGATION; } setSystemUiVisibility(newVis); } […]

How to add space between two textviews

I am new to android development and I was just wondering how can I add space between two TextViews? Any help would be appreciated. The code I have written so far <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”fill_parent” android:orientation=”vertical” > <TextView android:id=”@+id/lbl_group_coworkers” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:text=”Coworkers” /> <TextView android:id=”@id/lbl_group_” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:text=”Family”/> </LinearLayout>

Making two LinearLayouts have 50% of the screen each without using layout_weight

I’m currently doing a special xml layout of a landscape screen, where 4 images are present and 2 LinearLayouts are next to each other with 2 images each. These LinearLayouts I call linearLayout1 and linearLayout2. linearLayout1 is marked with blue rectangle: linearLayout2 is marked with blue rectangle: As you can see, the first one uses […]

Android: Align Parent Bottom + Bottom margin programmatically

How can I programatically add a RelativeLayout that is aligned to the bottom of parent, and add a margin or padding in the same RelativeLayout? Example:

How to set width and height for custom view in programmatically?

I have created a custom view named MyDraw ,this is my MyDraw code, public class MyDraw extends View { public MyDraw(Context context) { super(context); } public MyDraw(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public MyDraw(Context context, AttributeSet attrs) { super(context, attrs); } …………………………………. } I have added the view in XML […]

Android Bitmap resize

What is the best way of resizing a bitmap? Using options.inSampleSize = 2; Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.mandy_moore, options); or Bitmap resizedbitmap = Bitmap.createScaledBitmap(bitmap, 200, 200, true);

Call actvity after viewpager is finished

I’m developing an application in which I have to use viewpager and after all items in viewpager is finished I have to call an activity. I’m not able to get event listener for this. Here is what I have been refering too: https://github.com/chiuki/android–swipe-image-viewer/blob/master/src/com/sqisland/android/swipe_image_viewer/MainActivity.java Here is what I have done so far: public class MainActivity extends […]

Android Full Width ICS style Minimalist Bottom ButtonsViews

I want to make some buttons that look like this the following: I’ve looked pretty hard for preset ICS ones in the android.widget package, but I can’t find any. I figure there’s got to be an easy way, since they seem to be thematic of the entire OS version. If anyone knows of a way […]

Button and drawable left

I create button in xml file like this: <Button android:id=”@+id/call_button” android:layout_width=”match_parent” android:layout_height=”0dp” android:layout_marginTop=”30dp” android:background=”@drawable/button” android:layout_weight=”40″ android:drawableLeft=”@drawable/symbol_phone” android:paddingLeft=”20dp” android:drawablePadding=”-25dp” android:text=”Call” android:textColor=”@color/white” /> I would like to know how I can do drawableLeft in activity. I know that is stupid but I need do this in activity because I create button there. How I can do the […]

How to use setEmptyView() with custom list layout in ListFragment

I’m using a paginator with a few Fragments. I want to show a message when there are no entries in the list (Fragment). I tried to use Textview with android:id=”@id/android:empty but it doesn’t work. Custom list layout code: <?xml version=”1.0″ encoding=”utf-8″?> <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:padding=”@dimen/padding_medium” > <TextView android:id=”@+id/label_value” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_alignParentLeft=”true” android:layout_centerVertical=”true” android:layout_marginLeft=”@dimen/padding_medium” android:text=”@string/label_value” […]

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