LiangGaoUser / AndroidEbook

0 stars 0 forks source link

点击更多,跳转到图书列表 #4

Open LiangGaoUser opened 4 years ago

LiangGaoUser commented 4 years ago
<com.lianggao.whut.androidebook.View.DrawableTextView
            android:id="@+id/id_tv_book_recommend"
            android:layout_width="match_parent"
            android:layout_height="20dp"
            android:layout_below="@+id/id_tv_empty"
            android:gravity="left|end"
            android:background="@color/colorWhite"
            android:drawableRight="@drawable/icon_book_more2"
            android:padding="2dp"
            android:text="今日推荐"
            />
 //对更多图片进行监听并设置大小
            drawableTextView_recommed = (DrawableTextView) rootView.findViewById(R.id.id_tv_book_recommend);
            Drawable drawable2 = getResources().getDrawable(R.drawable.icon_book_more2);
            drawable2.setBounds(0, 0, 50, 50);
            drawableTextView_recommed.setCompoundDrawables(null, null, drawable2, null);
            drawableTextView_recommed.setDrawableRightClick(new DrawableTextView.DrawableRightClickListener() {
                @Override
                public void onDrawableRightClickListener(View view) {
                    Toast.makeText(getContext(),"点击了更多推荐",Toast.LENGTH_LONG).show();
                }
            });