Tag: android layout

ScrollView里面的ListView不在Android上滚动

我在ScrollView里滚动ListView时遇到了麻烦。 我有一个活动,其中有一些EditTexts在顶部,然后一个标签主机与两个选项卡有一个ListView每个。 当EditText视图集中时,软键盘出现,因为我有一个滚动视图,内容是可滚动的。 但是,当ListView中有更多的项目(标签中的项目)时,问题就来了,即使有更多的项目,我也无法滚动ListView。 以下是XML的布局: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="?backgroundImage" android:orientation="vertical"> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="50dip" android:layout_alignParentBottom="true" android:layout_margin="10dip" android:id="@+id/buttons"> <Button android:text="Save" android:layout_margin="2dip" android:textSize="20dip" android:id="@+id/btnSaveorUpdate" android:layout_height="wrap_content" android:layout_width="145dip"></Button> <Button android:text="Cancel" android:layout_margin="2dip" android:textSize="20dip" android:id="@+id/btnCancelorDelete" android:layout_height="wrap_content" android:layout_width="145dip"></Button> </LinearLayout> <ScrollView android:layout_above="@id/buttons" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillViewport="true" android:layout_margin="10dip"> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_margin="10dip"> <TextView android:text="Bill details" android:textColor="?textColorDark" android:layout_alignParentTop="true" android:id="@+id/txtEnterDetails" android:textSize="25dip" android:textStyle="bold" […]

android:layout_weight是什么意思?

我不明白如何使用这个属性。 任何人都可以告诉我更多关于它吗?

“px”,“dip”,“dp”和“sp”有什么区别?

以下是什么区别? PX 蘸 DP SP

Android:用于横向模式的备用布局xml

我怎么能有一个景观布局和一个肖像? 当用户将手机翻转过来时,我想要占用额外的宽度并节省垂直空间。

RelativeLayout中的百分比宽度

我正在为我的Android应用程序中的登录Activity工作。 下面的图片是我想让它看起来像: 我能用下面的XML实现这个布局。 问题是,这有点冒险。 我不得不为主机EditText硬编码一个宽度。 具体来说,我不得不指定: android:layout_width="172dp" 我真的想给主机和端口EditText的百分比宽度。 (主机80%,端口20%)这可能吗? 下面的XML适用于我的Droid,但它似乎并不适用于所有屏幕。 我真的很喜欢一个更强大的解决方案。 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/main" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/host_label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/home" android:paddingLeft="15dp" android:paddingTop="0dp" android:text="host" android:textColor="#a5d4e2" android:textSize="25sp" android:textStyle="normal" /> <TextView android:id="@+id/port_label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/home" android:layout_toRightOf="@+id/host_input" android:paddingTop="0dp" android:text="port" android:textColor="#a5d4e2" android:textSize="25sp" android:textStyle="normal" /> <EditText android:id="@+id/host_input" android:layout_width="172dp" android:layout_height="wrap_content" android:layout_below="@id/host_label" android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:layout_marginTop="4dp" android:background="@android:drawable/editbox_background" android:inputType="textEmailAddress" /> <EditText android:id="@+id/port_input" android:layout_width="100dp" […]

为什么LayoutInflater会忽略我指定的layout_width和layout_height布局参数?

我已经遇到了严重的麻烦让LayoutInflater按预期工作,其他人也如此: 如何使用layoutinflator在运行时添加视图? 。 为什么LayoutInflater忽略我指定的布局参数? 例如,为什么我的资源XML中的layout_width和layout_height值不符合要求?

.apk首次安装时如何启动服务

在我的应用程序中,我没有任何UI部分,所以我需要在应用程序安装到设备上后立即启动服务。 我看到很多的答案是不可能的,但我想这肯定是可能的。 只要看看Android Market上满足我的要求的PlanB应用程序。 下面是我的清单文件,我如何尝试,但服务没有被调用。 所以,让我知道什么是应用程序安装时启动服务的最佳方式。 UPDATE 我也尝试使用android.intent.action.PACKAGE_ADDED它工作正常检测其他应用程序包但不是为自己。 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.auto.start" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <application android:icon="@drawable/ic_launcher" > <service android:name=".MyService"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </service> <receiver android:name=".BootUpReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED"/> <category android:name="android.intent.category.DEFAULT"/> <action android:name="android.intent.action.PACKAGE_INSTALL" /> <action android:name="android.intent.action.PACKAGE_ADDED" /> <data android:scheme="package"/> </intent-filter> </receiver> </application> </manifest>

match_parent和fill_parent有什么区别?

我有点困惑两个XML属性: match_parent和fill_parent 。 看来,两者都是一样的。 他们之间有什么区别?