Java Code Examples for android.widget.ListView#setBackgroundResource()

The following examples show how to use android.widget.ListView#setBackgroundResource() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle bdl) {
    ListView lv = new ListView(getActivity());
    mAdapter = new ImsakiyeAdapter(getActivity());
    lv.setAdapter(mAdapter);
    setTimes(mTimes);
    TextView addMore = new TextView(getActivity());
    addMore.setText("\n" + getString(R.string.showMore) + "\n");
    addMore.setGravity(Gravity.CENTER);
    addMore.setOnClickListener(view -> {
        mAdapter.daysInMonth += 7;
        mAdapter.notifyDataSetInvalidated();
    });
    lv.addFooterView(addMore);
    lv.setBackgroundResource(R.color.background);
    return lv;
}
 
Example 2
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle bdl) {
    ListView lv = new ListView(getActivity());
    mAdapter = new ImsakiyeAdapter(getActivity());
    lv.setAdapter(mAdapter);
    setTimes(mTimes);
    TextView addMore = new TextView(getActivity());
    addMore.setText("\n" + getString(R.string.showMore) + "\n");
    addMore.setGravity(Gravity.CENTER);
    addMore.setOnClickListener(view -> {
        mAdapter.daysInMonth += 7;
        mAdapter.notifyDataSetInvalidated();
    });
    lv.addFooterView(addMore);
    lv.setBackgroundResource(R.color.background);
    return lv;
}
 
Example 3
Source Project: Android-Music-Player   File: popupList.java    License: MIT License 4 votes vote down vote up
public popupList(Context context, int width, int height) {
    super(context, width, height);
    setBackgroundColor(0x66000000);

    sl = new FMlyt(getContext(), Ui.cd.getHt(200), Ui.cd.getHt(300)){};
    sl.setBackgroundColor(0x00000000);
    sl.InCenter(width,height);

    rs = new radiusSqure(sl.width  - Ui.cd.getHt(4),sl.height - Ui.cd.getHt(4),0,0, Ui.cd.getHt(13));
    rs.setColor(popupBack.Color0);
   // addShape(rs);

    rb = new radiusBorder(sl.width,sl.height,0,0, Ui.cd.getHt(2), Ui.cd.getHt(13));
    rb.setColor(savebtnRingColor.Color0);
    sl.addShape(rb);

    presetAdapter data;
    listview = new ListView(getContext()){
        @Override
        protected void onDraw(Canvas canvas) {
            canvas.clipPath(rs.S0);
            super.onDraw(canvas);
        }
    };
    listview.setLayoutParams(new FrameLayout.LayoutParams( sl.width - Ui.cd.getHt(4), sl.height - Ui.cd.getHt(4)));

    listview.setDivider(null);
    listview.setX(Ui.cd.getHt(2));
    listview.setY(Ui.cd.getHt(2));
    listview.setBackgroundResource(0);
    //listview.setBackgroundColor(com.shape.home.slider.backgroundImg.Color0);
    data = new presetAdapter(){

        @Override
        public int getHeigtht() {
            return sl.width - Ui.cd.getHt(4);
        }

        @Override
        public void onReload(){
            if(listview != null){
                Ui.bk.back();
                popupList.this.onReload();
            }
        }
    };
    listview.setAdapter(data);
    sl.addView(listview);
    addView(sl);
}
 
Example 4
Source Project: Android-Music-Player   File: Main.java    License: MIT License 4 votes vote down vote up
public Main(Context context, int width, int height) {
    super(context, width, height);
    setBackgroundColor(0x00000000);
    This = this;

    squre sqTitle = new squre(width, Ui.cd.getHt(50),0,0);
    sqTitle.setColor(titleBack.Color0);
    addShape(sqTitle);

    squre btmSq = new squre(width, Ui.cd.getHt(120),0,height  - Ui.cd.getHt(120 + 60));
    btmSq.setColor(btmBack.Color0);
    addShape(btmSq);

    squre sq = new squre(width,height - Ui.cd.getHt(50) - btmSq.height + - Ui.cd.getHt(60),0, Ui.cd.getHt(50));
    sq.setColor(backgroundImg.Color0);
    addShape(sq);

    squre bmLine = new squre(width, Ui.cd.getHt(2) ,0,btmSq.y+ btmSq.height);
    bmLine.setColor(backgroundImg.Color0);
    addShape(bmLine);

    squre volumeBack = new squre(width, Ui.cd.getHt(60-2) ,0,bmLine.y+ bmLine.height);
    volumeBack.setColor(btmBack.Color0);
    addShape(volumeBack);

    VolumeRocker Vr = new VolumeRocker(getContext(),width,(int)volumeBack.height);
    Vr.setBackgroundResource(0);
    Vr.setY(volumeBack.y);

    addView(Vr);

    FMText title = textImg.getFMText(context,"Equalizer Presets", Ui.cd.getHt(18));
    title.img.setColor(textColor.Color0);
    title.InCenter(width, Ui.cd.getHt(50));
    title.setX(Ui.cd.getHt(10));
    addView(title);

    addWhells((int) btmSq.y, (int) btmSq.height);

    presetAdapter data;
    listview = new ListView(getContext());
    listview.setLayoutParams(new FrameLayout.LayoutParams((int)sq.width,(int)sq.height));
    listview.setY(sq.y);
    listview.setDivider(null);
    listview.setBackgroundResource(0);
    //listview.setBackgroundColor(com.shape.home.slider.backgroundImg.Color0);
    data = new presetAdapter(){
        @Override
        public void onReload(){
            if(listview != null){
                refreshData();
            }
        }
    };
    listview.setAdapter(data);
    addView(listview);

    final radioBtn rBtn = new radioBtn(getContext(), Ui.cd.getHt(95), Ui.cd.getHt(40));
    rBtn.InCenter(width, Ui.cd.getHt(50));
    rBtn.setX(width - rBtn.width - Ui.cd.getHt(5));
    addView(rBtn);


    Ui.ef.playerEvent.addEvent(new EventCall(new int[]{playerEvents.EQ_CHANGED, Ui.ef.Event_onBind}){
        @Override
        public void onCall(int eventId) {
            refreshData();
            rBtn.switchBtn(Ui.ef.MusicPlayer.handler.EQs.isOn);
        }
    });

}