本文實例講述了Android開發實現popupWindow彈出窗口自定義布局與位置控制方法。分享給大家供大家參考,具體如下:
布局文件:
主布局文件:activity_main:
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.bige.MainActivity" android:orientation="vertical"> <LinearLayout android:layout_marginTop="10dp" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content"> <LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content"> <Button android:textSize="20dp" android:paddingTop="10dp" android:gravity="left" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="3" android:text="富乃寶山" android:background="#AAAAAA"/> <Button android:layout_marginRight="5dp" android:layout_marginLeft="5dp" android:background="#AAAAAA" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="0點"/> <Button android:id="@+id/num1" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:textColor="@android:color/white" android:background="#000000" android:text="1"/> </LinearLayout> <LinearLayout android:layout_marginTop="10dp" android:layout_width="match_parent" android:layout_height="wrap_content"> <Button android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="ビ 主站蜘蛛池模板: 吉木萨尔县| 蕉岭县| 定日县| 沂南县| 瓦房店市| 绥中县| 斗六市| 陈巴尔虎旗| 收藏| 横峰县| 龙游县| 枝江市| 大埔县| 都昌县| 周口市| 宁津县| 邯郸县| 尉犁县| 冕宁县| 牡丹江市| 遂昌县| 黄龙县| 登封市| 台北市| 伊川县| 公安县| 高唐县| 赣州市| 卢湾区| 辽源市| 建宁县| 洞口县| 上犹县| 石楼县| 阿鲁科尔沁旗| 德清县| 朔州市| 福建省| 邵阳县| 邻水| 玉田县|