編輯:Android開發實例
- <?xml version="1.0" encoding="utf-8"?>
- <AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/mArtivleViewLayout" android:layout_width="fill_parent"
- android:layout_height="fill_parent" android:background="@drawable/white"
- androidrientation="vertical">
- <LinearLayout android:layout_y="350px" android:layout_x="0px"
- android:layout_width="fill_parent" android:id="@+id/TooLBarLayout"
- android:layout_height="44px" android:gravity="center"
- android:background="@drawable/toolbarbg" android:visibility="visible">
- <ImageView android:id="@+id/toolbar_pageup"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content" android:src="@drawable/toolbar_pageup">
- </ImageView>
- </LinearLayout>
- </AbsoluteLayout>
mLinearLayout = (LinearLayout) findViewById(R.id.TooLBarLayout);
mLinearLayout .offsetTopAndBottom(50);
mLinearLayout .offsetLeftAndRight(0);
這樣做一點返應都沒有
- package com.test;
- import android.app.Activity;
- import android.os.Bundle;
- import android.view.View;
- import android.view.ViewGroup;
- import android.webkit.WebView;
- import android.widget.AbsoluteLayout;
- import android.widget.LinearLayout;
- public class abslayout extends Activity {
- private WebView mWebView;
- private LinearLayout linearLayout;
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- this.setContentView(R.layout.abslayout);
- linearLayout = (LinearLayout) ((ViewGroup) findViewById(R.id.mArtivleViewLayout)) .getChildAt(0);
- linearLayout.setLayoutParams(new AbsoluteLayout.LayoutParams(linearLayout.getWidth(), linearLayout.getHeight(),
- linearLayout.getLeft() + 5, linearLayout.getTop() + 5));
- }
- }
- <?xml version="1.0" encoding="utf-8"?>
- <AbsoluteLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent" android:id="@+id/mArtivleViewLayout"
- android:layout_height="fill_parent" android:background="#ffffff">
- <LinearLayout android:layout_y="250px" android:layout_x="0px"
- android:layout_width="320px" android:id="@+id/LinearLayout01"
- android:layout_height="50px" android:background="#000000">
- </LinearLayout>
- </AbsoluteLayout>
將inearLayout.setLayoutParams...放到一個激活動作中就可以了(如button中),
- private class mPageUpOnClickListener implements OnClickListener {
- public void onClick(View v) {
- Log.v("AA","sfsdfsfsfsfs");
- linearLayout.setLayoutParams(new AbsoluteLayout.LayoutParams(
- linearLayout.getWidth(), linearLayout.getHeight(),
- linearLayout.getLeft() + 5, linearLayout.getTop() + 5));
- }
- }
JSON代表JavaScript對象符號。它是一個獨立的數據交換格式,是XML的最佳替代品。本章介紹了如何解析JSON文件,並從中提取所需的信息。Android提供了四個
本文實例講述了Android編程之客戶端通過socket與服務器通信的方法。分享給大家供大家參考,具體如下: 下面是一個demo,Android客戶端通過sock
前文介紹了Android中MediaPlayer用法的時候稍微介紹了SurfaceView,SurfaceView由於可以直接從內存或者DMA等硬件接口取得圖像數
TableLayout經常用到的屬性有: android:collapseColumns:以第0行為序,隱藏指定的列: android:collapseColum