فهرست منبع

ViewGroup.LayoutParams

yang 3 ماه پیش
والد
کامیت
8777071011
1فایلهای تغییر یافته به همراه2 افزوده شده و 3 حذف شده
  1. 2 3
      app/src/main/java/com/hanghui/senic/activity/MainActivity.java

+ 2 - 3
app/src/main/java/com/hanghui/senic/activity/MainActivity.java

@@ -9,7 +9,6 @@ import android.graphics.drawable.Drawable;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.ImageView;
-import android.widget.LinearLayout;
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
@@ -419,12 +418,12 @@ public class MainActivity extends BaseActivity {
      */
     private void updateNetworkTypeView() {
         if (NetWorkUtils.getNetworkType() != -1){
-            LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) iv_networkType.getLayoutParams();
+            ViewGroup.LayoutParams layoutParams = iv_networkType.getLayoutParams();
             layoutParams.width = (int) getResources().getDimension(R.dimen.dp_32);
             layoutParams.height =  (int) getResources().getDimension(R.dimen.dp_32);
             iv_networkType.setImageResource(NetWorkUtils.getNetworkType());
         } else {//无网络
-            LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) iv_networkType.getLayoutParams();
+            ViewGroup.LayoutParams layoutParams = iv_networkType.getLayoutParams();
             layoutParams.width = (int) getResources().getDimension(R.dimen.dp_72);
             layoutParams.height =  (int) getResources().getDimension(R.dimen.dp_32);
             iv_networkType.setImageResource(R.mipmap.network_icon_no);