File tree Expand file tree Collapse file tree
CustomControlLibs/src/main
java/com/example/customcontrollibs/viewground Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,17 +48,26 @@ private void initView() {
4848 private void initAttribteSet (AttributeSet attrs ) {
4949 TypedArray array = mContext .obtainStyledAttributes (attrs , R .styleable .ShowComment );
5050 isNetWorkUrl (array .getBoolean (R .styleable .ShowComment_isNetWorkUrl , true ));
51+ displayPicture (array .getBoolean (R .styleable .ShowComment_displayPicture ,true ));
5152 array .recycle ();
5253 }
5354
5455 public void setImageSize (int value ) {
55- int dp = DensityUtil .px2dip (mContext , value );
56+ int dp = DensityUtil .dip2px (mContext , value );
5657 LinearLayout .LayoutParams linearParams = (LinearLayout .LayoutParams ) message .getLayoutParams ();
5758 linearParams .width = dp ;
5859 linearParams .height = dp ;
5960 message .setLayoutParams (linearParams );
6061 }
6162
63+ public void displayPicture (boolean judge ) {
64+ if (judge ) {
65+ message .setVisibility (VISIBLE );
66+ } else {
67+ message .setVisibility (GONE );
68+ }
69+ }
70+
6271 public void isNetWorkUrl (boolean judge ) {
6372 this .judge = judge ;
6473 }
Original file line number Diff line number Diff line change 101101
102102 <declare-styleable name =" ShowComment" >
103103 <attr name =" isNetWorkUrl" format =" boolean" />
104+ <attr name =" displayPicture" format =" boolean" />
104105 </declare-styleable >
105106</resources >
You can’t perform that action at this time.
0 commit comments