編輯:關於Android編程
效果圖:
scrollview+listView 疊加嵌套實現
禁止滑動ListView :<喎?/kf/ware/vc/" target="_blank" class="keylink">vcD4KPHA+ICAgICAgICAgPC9wPgo8cHJlIGNsYXNzPQ=="brush:java;">import android.content.Context; import android.util.AttributeSet; import android.widget.ListView; public class MyListView extends ListView{ public MyListView(Context context, AttributeSet attrs) { super(context, attrs); } /** * 設置不滾動 */ public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); } } MainActivity:
import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; public class MainActivity extends Activity { private LinearLayout layout_parent1; private LinearLayout layout_parent2; private TextView year; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); layout_parent1=(LinearLayout)findViewById(R.id.layout_parent1); initView(); } private void initView() { // TODO Auto-generated method stub ArrayList list=AdapterBean.getAdapterBeanCollection(); for (int i = 0; i < list.size(); i++) { View view=getLayoutInflater().inflate(R.layout.item_scroll, null); layout_parent2=(LinearLayout)view.findViewById(R.id.layout_parent2); year=(TextView)view.findViewById(R.id.textView_year); year.setText(list.get(i).getYear()); layout_parent2.addView(ChildView.getInstance(getLayoutInflater()).getView()); layout_parent1.addView(view); } } }
ChildView:
import android.view.LayoutInflater; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.Toast; public class ChildView implements OnItemClickListener{ public static ChildView child=null; private static LayoutInflater inflater; public static ChildView getInstance(LayoutInflater layoutInflater) { // TODO Auto-generated method stub inflater=layoutInflater; return new ChildView(layoutInflater); } private View view; private MyListView noScrolistview; private MyAdapter adapter; public ChildView(LayoutInflater layoutInflater){ view=layoutInflater.inflate(R.layout.item_main, null); initialization(); } private void initialization() { // TODO Auto-generated method stub noScrolistview=(MyListView)view.findViewById(R.id.NoScrollListview); adapter=new MyAdapter(inflater,TestBean.getTestBeanCollection()); noScrolistview.setAdapter(adapter); noScrolistview.setOnItemClickListener(this); } public View getView() { // TODO Auto-generated method stub return view; } @Override public void onItemClick(AdapterView> adapterview, View view, int position, long id) { // TODO Auto-generated method stub Toast.makeText(inflater.getContext(), "Position: "+position, Toast.LENGTH_SHORT).show(); } }如果需要具體到號數分類,同理
0x00原理部分我不獻丑了,上面3篇文章說的很清楚,我直接實戰,講述從0開始如何最終實現加固的整個過程,踩了不少坑。0x01第一步創建被加固Apk,就是你的源碼Apk。
Android性能的優化主要分為兩點1、布局優化2、內存優化布局優化首先來看一下布局優化,系統在渲染UI的時候會消耗大量的資源,所以,對布局的優化就顯得尤為重要避免Ove
1.概述 Fragment是Activity中用戶界面的一個行為或者是一部分。主要是支持在大屏幕上動態和更為靈活的去組合或是交換UI組件,通過將activity的布局分
初次用到回調是在Fragment和Activity之間進行通信的時候,當時感覺很難理解,但又覺得這個方法使用起來很方便,所以對它進行仔細的研究。發現回調不僅僅是實現功能那