标签:util def utf-8 padding vertica bind www visible tab
bind,graud 里面添加
dataBinding {
enabled = true
}
作者:希灵丶
链接:http://www.jianshu.com/p/981a2aa956b2
來源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
作者:希灵丶
链接:http://www.jianshu.com/p/981a2aa956b2
來源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
<?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android"> <data> <variable name="viewModel" type="com.shire.mvvmdemo.viewModel.MainViewModel" /> </data> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activi 作者:希灵丶 链接:http://www.jianshu.com/p/981a2aa956b2 來源:简书 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main); binding.setViewModel(new MainViewModel(binding)); } } 作者:希灵丶 链接:http://www.jianshu.com/p/981a2aa956b2 來源:简书 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
作者:希灵丶
链接:http://www.jianshu.com/p/981a2aa956b2
來源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
public class MainViewModel implements onSearchListener { private ActivityMainBinding binding; private SearchModel searchModel = new SearchModel(); private Handler handler; public MainViewModel(ActivityMainBinding binding) { this.binding = binding; handler = new Handler(Looper.getMainLooper()); } public void search(View view) { binding.pbLoad.setVisibility(View.VISIBLE); searchModel.getIPaddressInfo(binding.etIp.getText().toString().trim(), this); } @Override public void onSuccess(final IPAddress ipAddress) { handler.post(new Runnable() { @Override public void run() { binding.pbLoad.setVisibility(View.GONE); binding.tvMsg.setText(ipAddress.toString()); } }); } @Override public void onError() { handler.post(new Runnable() { @Override public void run() { binding.pbLoad.setVisibility(View.GONE); binding.tvMsg.setText("查询失败"); } }); } } 作者:希灵丶 链接:http://www.jianshu.com/p/981a2aa956b2 來源:简书 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
public class MainViewModel implements onSearchListener { private ActivityMainBinding binding; private SearchModel searchModel = new SearchModel(); private Handler handler; public MainViewModel(ActivityMainBinding binding) { this.binding = binding; handler = new Handler(Looper.getMainLooper()); } public void search(View view) { binding.pbLoad.setVisibility(View.VISIBLE); searchModel.getIPaddressInfo(binding.etIp.getText().toString().trim(), this); } @Override public void onSuccess(final IPAddress ipAddress) { handler.post(new Runnable() { @Override public void run() { binding.pbLoad.setVisibility(View.GONE); binding.tvMsg.setText(ipAddress.toString()); } }); } @Override public void onError() { handler.post(new Runnable() { @Override public void run() { binding.pbLoad.setVisibility(View.GONE); binding.tvMsg.setText("查询失败"); } }); } } 作者:希灵丶 链接:http://www.jianshu.com/p/981a2aa956b2 來源:简书 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
作者:希灵丶
链接:http://www.jianshu.com/p/981a2aa956b2
來源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
标签:util def utf-8 padding vertica bind www visible tab
原文地址:http://www.cnblogs.com/leshen/p/7842639.html