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

The following are Jave code examples for showing how to use setPaddingRelative() 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.
Example 1
Project: FlickLauncher   File: WidgetsListAdapter.java   Source Code and License Vote up 6 votes
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
@Override
public WidgetsRowViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    if (DEBUG) {
        Log.v(TAG, "\nonCreateViewHolder");
    }

    ViewGroup container = (ViewGroup) mLayoutInflater.inflate(
            R.layout.widgets_list_row_view, parent, false);
    LinearLayout cellList = (LinearLayout) container.findViewById(R.id.widgets_cell_list);

    // if the end padding is 0, then container view (horizontal scroll view) doesn't respect
    // the end of the linear layout width + the start padding and doesn't allow scrolling.
    if (Utilities.ATLEAST_JB_MR1) {
        cellList.setPaddingRelative(mIndent, 0, 1, 0);
    } else {
        cellList.setPadding(mIndent, 0, 1, 0);
    }

    return new WidgetsRowViewHolder(container);
}
 
Example 2
Project: SimpleUILauncher   File: WidgetsListAdapter.java   Source Code and License Vote up 6 votes
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
@Override
public WidgetsRowViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    if (DEBUG) {
        Log.v(TAG, "\nonCreateViewHolder");
    }

    ViewGroup container = (ViewGroup) mLayoutInflater.inflate(
            R.layout.widgets_list_row_view, parent, false);
    LinearLayout cellList = (LinearLayout) container.findViewById(R.id.widgets_cell_list);

    // if the end padding is 0, then container view (horizontal scroll view) doesn't respect
    // the end of the linear layout width + the start padding and doesn't allow scrolling.
    if (Utilities.ATLEAST_JB_MR1) {
        cellList.setPaddingRelative(mIndent, 0, 1, 0);
    } else {
        cellList.setPadding(mIndent, 0, 1, 0);
    }

    return new WidgetsRowViewHolder(container);
}