Java Code Examples for android.widget.LinearLayout.getPaddingLeft()

The following are Jave code examples for showing how to use getPaddingLeft() of the android.widget.LinearLayout class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: RLibrary   File:   View Source Code Vote up 6 votes
public static void fill(LinearLayout linearLayout, ArrayList<ItemInfo> itemInfos) {
    for (ItemInfo info : itemInfos) {
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(-1, info.itemHeight);
        TextView textView = makeItem(linearLayout.getContext(), info);

        int paddingLeft = linearLayout.getPaddingLeft();
        if (paddingLeft > 0) {
            params.setMargins(params.leftMargin - paddingLeft, params.topMargin,
                    params.rightMargin, params.bottomMargin);
            textView.setPadding(paddingLeft + textView.getPaddingLeft(), textView.getPaddingTop(),
                    textView.getPaddingRight(), textView.getPaddingBottom());

        linearLayout.addView(textView, params);