Search in sources :

Example 96 with LayoutParams

use of android.support.v7.app.ActionBar.LayoutParams in project ListenerMusicPlayer by hefuyicoder.

the class ArtistDetailFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fragment_artist_detail, container, false);
    if (Build.VERSION.SDK_INT >= 19 && Build.VERSION.SDK_INT < 21) {
        root.findViewById(R.id.app_bar).setFitsSystemWindows(false);
        root.findViewById(R.id.artist_art).setFitsSystemWindows(false);
        root.findViewById(R.id.gradient).setFitsSystemWindows(false);
        Toolbar toolbar = (Toolbar) root.findViewById(R.id.toolbar);
        CollapsingToolbarLayout.LayoutParams layoutParams = (CollapsingToolbarLayout.LayoutParams) toolbar.getLayoutParams();
        layoutParams.height += DensityUtil.getStatusBarHeight(getContext());
        toolbar.setLayoutParams(layoutParams);
        toolbar.setPadding(0, DensityUtil.getStatusBarHeight(getContext()), 0, 0);
    }
    return root;
}
Also used : CollapsingToolbarLayout(android.support.design.widget.CollapsingToolbarLayout) ImageView(android.widget.ImageView) BindView(butterknife.BindView) View(android.view.View) Toolbar(android.support.v7.widget.Toolbar)

Example 97 with LayoutParams

use of android.support.v7.app.ActionBar.LayoutParams in project ListenerMusicPlayer by hefuyicoder.

the class AlbumDetailFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fragment_album_detail, container, false);
    if (Build.VERSION.SDK_INT >= 19 && Build.VERSION.SDK_INT < 21) {
        root.findViewById(R.id.app_bar).setFitsSystemWindows(false);
        root.findViewById(R.id.album_art).setFitsSystemWindows(false);
        root.findViewById(R.id.gradient).setFitsSystemWindows(false);
        Toolbar toolbar = (Toolbar) root.findViewById(R.id.toolbar);
        CollapsingToolbarLayout.LayoutParams layoutParams = (CollapsingToolbarLayout.LayoutParams) toolbar.getLayoutParams();
        layoutParams.height += DensityUtil.getStatusBarHeight(getContext());
        toolbar.setLayoutParams(layoutParams);
        toolbar.setPadding(0, DensityUtil.getStatusBarHeight(getContext()), 0, 0);
    }
    return root;
}
Also used : CollapsingToolbarLayout(android.support.design.widget.CollapsingToolbarLayout) ImageView(android.widget.ImageView) BindView(butterknife.BindView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) Toolbar(android.support.v7.widget.Toolbar)

Example 98 with LayoutParams

use of android.support.v7.app.ActionBar.LayoutParams in project ListenerMusicPlayer by hefuyicoder.

the class PlaylistDetailFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root = inflater.inflate(R.layout.fragment_album_detail, container, false);
    if (Build.VERSION.SDK_INT >= 19 && Build.VERSION.SDK_INT < 21) {
        root.findViewById(R.id.app_bar).setFitsSystemWindows(false);
        root.findViewById(R.id.album_art).setFitsSystemWindows(false);
        root.findViewById(R.id.gradient).setFitsSystemWindows(false);
        Toolbar toolbar = (Toolbar) root.findViewById(R.id.toolbar);
        CollapsingToolbarLayout.LayoutParams layoutParams = (CollapsingToolbarLayout.LayoutParams) toolbar.getLayoutParams();
        layoutParams.height += DensityUtil.getStatusBarHeight(getContext());
        toolbar.setLayoutParams(layoutParams);
        toolbar.setPadding(0, DensityUtil.getStatusBarHeight(getContext()), 0, 0);
    }
    return root;
}
Also used : CollapsingToolbarLayout(android.support.design.widget.CollapsingToolbarLayout) ImageView(android.widget.ImageView) BindView(butterknife.BindView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) Toolbar(android.support.v7.widget.Toolbar)

Example 99 with LayoutParams

use of android.support.v7.app.ActionBar.LayoutParams in project TwinklingRefreshLayout by lcodecorex.

the class ScrollingUtil method getRecyclerViewItemTopInset.

/**
     * 通过反射获取RecyclerView的item的topInset
     *
     * @param layoutParams
     * @return
     */
private static int getRecyclerViewItemTopInset(RecyclerView.LayoutParams layoutParams) {
    try {
        Field field = RecyclerView.LayoutParams.class.getDeclaredField("mDecorInsets");
        field.setAccessible(true);
        // 开发者自定义的滚动监听器
        Rect decorInsets = (Rect) field.get(layoutParams);
        return decorInsets.top;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return 0;
}
Also used : Field(java.lang.reflect.Field) Rect(android.graphics.Rect) RecyclerView(android.support.v7.widget.RecyclerView)

Example 100 with LayoutParams

use of android.support.v7.app.ActionBar.LayoutParams in project UltimateAndroid by cymcsg.

the class TwoWayLayoutManager method makeAndAddView.

private View makeAndAddView(int position, Direction direction, Recycler recycler) {
    final View child = recycler.getViewForPosition(position);
    final boolean isItemRemoved = ((LayoutParams) child.getLayoutParams()).isItemRemoved();
    if (!isItemRemoved) {
        addView(child, (direction == Direction.END ? -1 : 0));
    }
    setupChild(child, direction);
    if (!isItemRemoved) {
        updateLayoutEdgesFromNewChild(child);
    }
    return child;
}
Also used : LayoutParams(android.support.v7.widget.RecyclerView.LayoutParams) MarginLayoutParams(android.view.ViewGroup.MarginLayoutParams) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Aggregations

View (android.view.View)140 RecyclerView (android.support.v7.widget.RecyclerView)127 TextView (android.widget.TextView)46 ImageView (android.widget.ImageView)38 ViewGroup (android.view.ViewGroup)33 LinearLayout (android.widget.LinearLayout)27 LayoutParams (android.support.v7.widget.RecyclerView.LayoutParams)17 Paint (android.graphics.Paint)15 StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)15 FrameLayout (android.widget.FrameLayout)15 BindView (butterknife.BindView)12 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)11 Toolbar (android.support.v7.widget.Toolbar)11 Rect (android.graphics.Rect)9 EditText (android.widget.EditText)9 OrientationHelperEx (com.alibaba.android.vlayout.OrientationHelperEx)9 AdapterView (android.widget.AdapterView)8 RelativeLayout (android.widget.RelativeLayout)8 VirtualLayoutManager (com.alibaba.android.vlayout.VirtualLayoutManager)8 SuppressLint (android.annotation.SuppressLint)7