android懸浮
A. android 我想讓TextView 懸浮 該怎麼做啊、 謝謝
package com.cn.lhq;
import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
public class FloatingViewApp extends ListActivity {
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
String[] mStrings = new String[] { "Item 1", "Item 2", "Item 3",
"Item 4", "Item 5", "Item 6", "Item 7", "Item 8", "Item 9",
"Item 10", "Item 11", "Item 12" };
this.setListAdapter(new ArrayAdapter(this,
android.R.layout.simple_list_item_1, mStrings));
}
}
package com.cn.lhq;
import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
public class FloatingViewApp extends ListActivity {
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
String[] mStrings = new String[] { "Item 1", "Item 2", "Item 3",
"Item 4", "Item 5", "Item 6", "Item 7", "Item 8", "Item 9",
"Item 10", "Item 11", "Item 12" };
this.setListAdapter(new ArrayAdapter(this,
android.R.layout.simple_list_item_1, mStrings));
}
}
main.xml:
view plain to clipboardprint?
<?xml version="1.0" encoding="UTF-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
<TextView android:id="@android:id/empty"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="123"/>
</LinearLayout>
<Button android:id="@+id/floating_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="懸浮按鈕"
android:padding="5dip"
android:layout_margin="5dip"
android:layout_gravity="right|bottom" />
</FrameLayout>
<?xml version="1.0" encoding="UTF-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
<TextView android:id="@android:id/empty"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="123"/>
</LinearLayout>
<Button android:id="@+id/floating_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="懸浮按鈕"
android:padding="5dip"
android:layout_margin="5dip"
android:layout_gravity="right|bottom" />
</FrameLayout>
這是別人的一個代碼,希望對你有作用,我個人理解為,你的布局應該這么做,先設計一個大的布局,然後再設計一個小的布局,將你的TextView與小布局分開,但是還是在大的布局下面.希望我的回答對你有幫助!
B. 在android 懸浮層中放一個fragment
new一個Layout 然後把Fragment add進去
C. 如何在Android中實現懸浮Activity
在Android中實現懸浮Activity可以通過以下方式完成:
1、將需要懸浮的Activity設置dialog的樣式主題,定義樣式文件如下:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="FullHeightDialog" parent="android:style/Theme.Dialog">
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
</resources>
2、在在清單文件中給activity設置theme
<activity
android:name=".MainActivity"
android:configChanges="locale|keyboardHidden|orientation"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/FullHeightDialog"
D. android懸浮按鈕 點擊返回
你這個按鈕可以做成類似於抽屜這種形式
E. Android懸浮控制項怎麼實現
樓主說的應該是類似現在許多通訊錄軟體右側的字母索引滾動條那種效果吧?
F. 如何實現android炫酷懸浮球菜單
谷歌地圖應該是沒法實現離線地圖導航的把,畢竟谷歌地圖到現在也沒出離線地圖包下載,只是支持區域地圖下載緩存,導航的話,離線導航的話肯定要下載大范圍的地圖才行啊。 在一點,說下離線導航,離線導航也就意味這你要講所有的導航數據存儲到你手機本機,然後使用GPS來實現。但這有個問題,離線導航的數據肯定是很大的(我知道的離線地圖包最小的老虎地圖全國離線地圖包也要208兆呢,這還是壓縮包的大小),還有各種分類信息數據,這就要求你手機有很大的內存才行,但這對於手機而言並不劃算的,畢竟用手機導航的次數應該不多的--如果你天天用那麼建議你購買專門的導航儀吧,智能手機開啟GPS以及屏幕常量是非常耗電的,Android手機更甚。 以上我建議你還是放棄離線地圖導航的想法吧。下載個其他的手機地圖軟體,比如我上面說的老虎地圖,離線地圖包小,而且定位使用流量耗費也不大的。還有使用離線地圖+在線服務這種模式的手機地圖每次查詢都是最新的數據,畢竟你出行、無論公交、或者大樓大廈、餐廳之類的都可能有變動,這也是使用在線服務的一大優勢。這方面個人感覺老虎地圖做的也不錯,信息也比較全面了。 就是老虎地圖的導航不怎麼樣,不過也基本能用,呵呵,以上你可以給你的客戶講嘛,不用客戶說什麼就說什麼,你說可以留著最大的存儲存歌曲啊、存視頻之類的,比導航有更適用。還有要強調他買的是手機,不是導航儀。對了,老虎地圖說是可以離線定位,就是說沒有網路的情況下,在空曠的地方可以GPS定位--不在空曠的地方沒有GPS信號的 以上希望我的回答可幫助到你!!
G. android懸浮窗優先順序,如何使自己寫的懸浮窗懸浮於一切懸浮窗及下拉菜單自上
設置成phone類型的,可以保證永遠是在最上方的,因為打電話級別高於一切。
this.getWindow().setType(WindowManager.LayoutParams.TYPE_PHONE);
H. android里懸浮窗如何覆蓋狀態欄
TYPE_SYSTEM_OVERLAY
我的護眼軟體就是用這個的,連長按掛機鍵的系統提示框都可以覆蓋
I. 怎麼在android懸浮窗口上實現倒計時
public class XuanfuTestActivity extends Activity {
/** Called when the activity is first created. */
int num=10;
String text;
Button button;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
button=new Button(getApplicationContext());//這里不能寫this 否則沒有效果
WindowManager wmManager=(WindowManager)getApplicationContext(). getSystemService(Context.WINDOW_SERVICE);
WindowManager.LayoutParams params=new WindowManager.LayoutParams();
params.type=WindowManager.LayoutParams.TYPE_PHONE ;
params.type=2002;
params.flags=40;
params.width=50;
params.height=50;
wmManager.addView(button, params);
handler.sendEmptyMessageDelayed(1, 1000);
}
Handler handler=new Handler(){
public void handleMessage(android.os.Message msg) {
if (msg.what==1) {
text=""+num--;
button.setText(text);
}
if (num<=0) {
num=0;
}else {
handler.sendEmptyMessageDelayed(1, 1000);
}
};
};
}
J. android java 怎麼設置懸浮窗(懸浮窗是一個activity)上組件的屬性,和按鈕的點擊
@Override
public void onClick(View v) {
final EditText et = new EditText(context) ;
new AlertDialog.Builder(context)
.setTitle("說明")
.setMessage("單個頁卡內按鈕事件測試")
.setView(et)
.setPositiveButton("確定",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(context, "單擊確定按鈕", Toast.LENGTH_LONG).show() ;
}
}).setNegativeButton("取消",null).show();
}