Tag: android-layout

match_parent doesn't work with CoordinatorLayout

I use the Android Design Support Library (com.android.support:appcompat-v7:22.2.0) and I have a LinearLayout in CoordinatorLayout like this: <android.support.design.widget.CoordinatorLayout android:id=”@+id/rootLayout” android:layout_width=”match_parent” android:layout_height=”match_parent”> <android.support.design.widget.AppBarLayout android:layout_width=”match_parent” android:layout_height=”wrap_content”> <android.support.v7.widget.Toolbar android:id=”@+id/toolbar” android:layout_width=”match_parent” android:layout_height=”?attr/actionBarSize” android:background=”?attr/colorPrimary” app:popupTheme=”@style/ThemeOverlay.AppCompat.Light” app:theme=”@style/ThemeOverlay.AppCompat.Dark.ActionBar”> </android.support.v7.widget.Toolbar> </android.support.design.widget.AppBarLayout> <!– Content –> <LinearLayout android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical” android:background=”#44ff44″ app:layout_behavior=”@string/appbar_scrolling_view_behavior”> <Button android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:text=”Yo Yo” /> <Button android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:text=”Yo Yo” /> </LinearLayout> […]

ActionBarSherlock spinner not selectable ins ActionBar – Theme related

Some users of my application are experiencing a weird problem when using my application in landscape mode. I am using actionbarsherlock and have set the navigation mode to tabs (using ActionBar.NAVIGATION_MODE_TABS). Some users are finding when launching the app in portrait and then rotating the device the actionbar shows a spinner list rather than the […]

Shadow beneath Actionbar-compat while using paddings

I’m working on an Android application which uses the compatibility package from Google for getting fragments and such in Android 2.x. The actionbar has been created based on Google’s example. A white “shadow” has been put beneath it using <item name=”android:windowContentOverlay”>@drawable/actionbar_shadow</item> However the object below the actionbar (a fragment) contains a ListView with the following […]

How to add an image to a button in android

I was wondering how I put an image to a button. I have tried to use “android:icon=”@drawable/search.png” and I add this image to the drawable-hdpi folder but the image doesn’t show up. I am developing an application for the nexus 4 so I don’t know what size the image should be. The image I am […]

ListView ignoring wrap_content

I have a problem with the ListView in Android. When I set android:layout_height=”wrap_content”, ListView stays just one or two rows long and I can’t find a way to make him “wrapped”. <FrameLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:orientation=”vertical” android:layout_width=”fill_parent” android:layout_height=”fill_parent”> <ScrollView android:layout_width=”fill_parent” android:layout_height=”fill_parent”> <LinearLayout android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:orientation=”vertical” android:gravity=”center”> <TextView android:id=”@+id/question” android:layout_width=”fill_parent” android:layout_height=”wrap_content” /> <ListView android:id=”@+id/ListView01″ android:layout_width=”fill_parent” android:layout_height=”wrap_content” /> </LinearLayout> […]

Android Studio not rendering layout

I have started a new android studio project and on opening of the main activity, the design view shows this error and does not show the layout on the emulator: org.jetbrains.android.uipreview.RenderingException: Failed to load the LayoutLib: com/android/layoutlib/bridge/Bridge : Unsupported major.minor version 52.0 at org.jetbrains.android.uipreview.LayoutLibraryLoader.load(LayoutLibraryLoader.java:90) at org.jetbrains.android.sdk.AndroidTargetData.getLayoutLibrary(AndroidTargetData.java:180) at com.android.tools.idea.rendering.RenderService.createTask(RenderService.java:166) at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$6.run(AndroidDesignerEditorPanel.java:475) at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320) at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310) at […]

Customizing Android ScrollView's Vertical Scrollbar

I need to customize ScrollView so it will look like in the picture: I already successfully customized the Thumb and the Track, but I don’t know how to add Arrows like in the picture I provided. Here is the style I’m using: <!– Scrollbar –> <style name=”scroll_view”> <item name=”android:scrollbarAlwaysDrawVerticalTrack”>true</item> <item name=”android:scrollbars”>vertical</item> <item name=”android:fadeScrollbars”>false</item> <item name=”android:scrollbarThumbVertical”>@drawable/sb_thumb</item> […]

How to disable dates before today date in DatePickerDialog Android?

I want to disable the dates before today date in the DatePickerDialog .I am new in android please suggest me how could i do this .Here is my code that i have written for DatePickerDialog final DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { // […]

How to Change Text Style in Preference Fragment

I have created Preference Screen with Text View.User can change Text view style like font,color,size in Preference screen.so it will displayed on Textview which i have created in Preference Screen.but its not working .If its preference Activity ,we can use setContentview,In fragments i don’t know how to pass the view.. public final class TestFragment2 extends […]

How to send data from Activity to Fragment

I know there are many topics about this here. I have also read documentation many times but I can’t find the best way to pass data from activity to fragment. I want to be able to show the results of my Searchable activity in two differents layouts (list and map) using swipe Views with tabs. […]

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