×
嵌入式开发 > 详情

Android系统开发全攻略(二)

发布时间:2020-07-06 发布时间:
|

一、Android智能手机远程视频监控的设计

l] view plaincopyprint?

《span style=“font-family:Comic Sans MS;font-size:18px;”》《?xml version=“1.0” encoding=“utf-8”?》

《RelativeLayout xmlns:android=“/zixunimg/eepwimg/schemas.android.com/apk/res/android”

android:layout_height=“wrap_content” android:paddingBottom=“4dip”

android:layout_width=“fill_parent”》

《ImageView android:layout_height=“wrap_content” android:id=“@+id/ItemImage”

android:layout_width=“wrap_content” android:layout_centerHorizontal=“true”》

《/ImageView》

《TextView android:layout_width=“wrap_content”

android:layout_below=“@+id/ItemImage” android:layout_height=“wrap_content”

android:text=“TextView01” android:layout_centerHorizontal=“true”

android:id=“@+id/ItemText”》

《/TextView》

《/RelativeLayout》 《/span》

《span style=“font-family:Comic Sans MS;font-size:18px;”》《?xml version=“1.0” encoding=“utf-8”?》

《RelativeLayout xmlns:android=“/zixunimg/eepwimg/schemas.android.com/apk/res/android”

android:layout_height=“wrap_content” android:paddingBottom=“4dip”

android:layout_width=“fill_parent”》

《ImageView android:layout_height=“wrap_content” android:id=“@+id/ItemImage”

android:layout_width=“wrap_content” android:layout_centerHorizontal=“true”》

《/ImageView》

《TextView android:layout_width=“wrap_content”

android:layout_below=“@+id/ItemImage” android:layout_height=“wrap_content”

android:text=“TextView01” android:layout_centerHorizontal=“true”

android:id=“@+id/ItemText”》

《/TextView》

《/RelativeLayout》 《/span》

Panel.java是本文核心,抽屉组件的源码,这个抽屉只实现了从右往左的弹出/从左往右的收缩,读者可以根据自己的需要修改源码来改变抽屉动作的方向:

[java] view plaincopyprint?

《span style=“font-family:Comic Sans MS;font-size:18px;”》public class Panel extends LinearLayout{

public interface PanelClosedEvent {

void onPanelClosed(View panel);

}

public interface PanelOpenedEvent {

void onPanelOpened(View panel);

}

/**Handle的宽度,与Panel等高*/

private final static int HANDLE_WIDTH=30;

/**每次自动展开/收缩的范围*/

private final static int MOVE_WIDTH=20;

private Button btnHandle;

private LinearLayout panelContainer;

private int mRightMargin=0;

private Context mContext;

private PanelClosedEvent panelClosedEvent=null;

private PanelOpenedEvent panelOpenedEvent=null;

/**

* otherView自动布局以适应Panel展开/收缩的空间变化

* @author GV

*

*/



『本文转载自网络,版权归原作者所有,如有侵权请联系删除』

热门文章 更多
Recogni:将高端AI芯片推向自动驾驶边缘