Asked  7 Months ago    Answers:  5   Viewed   20 times

I'm a little confused about two XML properties: match_parent and fill_parent. It seems that both are the same. Is there any difference between them?



They're the same thing (in API Level 8+). Use match_parent.

FILL_PARENT (renamed MATCH_PARENT in API Level 8 and higher), which means that the view wants to be as big as its parent (minus padding)


fill_parent: The view should be as big as its parent (minus padding). This constant is deprecated starting from API Level 8 and is replaced by match_parent.

Tuesday, June 1, 2021
answered 7 Months ago

This will do what you want, with either an image of fixed height, or calculated programatically.

<RelativeLayout xmlns:android=""
    android:layout_height="match_parent" >

        android:layout_height="200dp" >

        android:layout_below="@id/layoutTop" >

        android:layout_marginBottom="-20dp" <!-- This should be always half the height, can also be calculated and added programtically -->
        android:src="@drawable/ic_launcher" />

Saturday, July 17, 2021
answered 5 Months ago
  • colorPrimary – The color of the app bar.
  • colorPrimaryDark – The color of the status bar and contextual app bars; this is normally a dark version of colorPrimary.
  • colorAccent – The color of UI controls such as check boxes, radio buttons, and edit text boxes.
  • windowBackground – The color of the screen background.
  • textColorPrimary – The color of UI text in the app bar.
  • statusBarColor – The color of the status bar.
  • navigationBarColor – The color of the navigation bar.

you can use following link to setup your style.

Sunday, August 8, 2021
answered 4 Months ago

There are two key differences:

First, attributes assigned to a view via style will apply only to that view, while attributes assigned to it via android:theme will apply to that view as well as all of its children. For example, consider this style resource:

<style name="my_background">
    <item name="android:background">@drawable/gradient</item>

If we apply it to a LinearLayout with three child TextViews by using style="@style/my_background", then the linearlayout will draw with a gradient background, but the backgrounds of the textviews will be unchanged.

If instead we apply it to the LinearLayout using android:theme="@style/my_background" then the linearlayout and each of the three textviews will all use the gradient for their background.

The second key difference is that some attributes only affect views if they are defined in that view's theme. For example, consider this style resource:

<style name="checkboxes">
    <item name="colorAccent">#caf</item>
    <item name="colorControlNormal">#caf</item>

If I apply this to a CheckBox using style="@style/checkboxes", nothing will happen. If instead I apply it using android:theme="@style/checkboxes", the color of the checkbox will change.

Just like the first rule said, styles containing theme attributes will apply to all children of the view with the android:theme attribute. So I can change the color of all checkboxes in a linearlayout by applying android:theme="@style/checkboxes" to my linearlayout.

Sunday, August 22, 2021
answered 4 Months ago

In your getView(), change

return parent;      


return rowView;

getView() should return the row view and not the parent where the rows are placed in. The parent view is only supplied as a paramteter so that view inflation can deal with match_parent sizes and such.

Tuesday, November 2, 2021
Pratap Vhatkar
answered 1 Month ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :