我有两个不同的main.xml文件,一个用于纵向,一个用于布局.每个人都在Scrollview内部的RelativeLayout中包含此代码.
<LinearLayout
android:id="@+id/name_phone"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/acquire"
>
<EditText
android:id="@+id/name"
android:inputType="textPersonName"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="observer name"
android:nextFocusDown="@id/phone"
android:background="@android:drawable/editbox_background"
/>
<EditText
android:id="@+id/phone"
android:inputType="phone"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="phone number"
android:nextFocusDown="@id/phone"
android:background="@android:drawable/editbox_background"
/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
等......
怪异的是:据我所知,你是不是应该能够指还没有在XML中没有发生过的事情,因此Android:nextFocusDown ="@ ID /手机",因为手机处理不当被宣布失效; 这就是我的风景xml中发生的事情,但不是肖像.在肖像中它完美地工作,并通过所有四个EditTexts传递焦点,没有任何障碍.如果我将NextFocusDown放入格局中,它将无法编译,声明"找不到与给定名称匹配的资源(在'nextFocusDown'处,值为'@id/phone')."
解决方案或解释会很棒.我的想法是,我在两个不同的LinearLayouts中有四个文本框,无论哪个有焦点,首先会将它传递给它下面的EditText,跳过其他的.我希望它能够像我在纵向布局中那样工作,当用户点击名称的下一个,焦点移动到手机,当他们点击它接下来它移动到电子邮件等时.我也很好奇为什么它是让这个工作在纵向而不是景观.
我已经看到了很多与此相似的问题,但我认为这仍然具有新的意义:
1)当你设置引力时提示文本消失
2)android:ellipsize="start"修复了所以你可以有中心提示和居中文本
3)为什么下面的代码仍然显示居中提示文字?
<EditText
android:id="@+id/details"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:hint="use this area to provide specific identification information including approximate size, vessel name and registration numbers if available"
android:background="@android:drawable/editbox_background"
android:layout_below="@id/details_title"
/>
Run Code Online (Sandbox Code Playgroud)
是因为fill_parent而不是wrap_content?我想也许是因为这个暗示是多线的,但我缩短了它,它仍然出现并且居中.这是我和其他需要android:ellipsize="start"正确显示的EditTexts之间的唯一区别.它只是一个错误吗?
当我使用Android SDK和AVD Manager与Eclipse时,我遇到了各种奇怪的错误,比如标题中的错误.一般来说,我只是拔掉手机并将其重新插入或关闭并重新打开Eclipse,但这令人沮丧.显然Conversion to Dalvik format failed: Unable to execute dex: wrapper was not properly loaded first不允许我编译我的应用程序,我认为这是因为我试图运行模拟器与模拟器的一些建议是如此之慢,无济于事.我想我应该在Ubuntu 11.04上添加运行eclipse 3.5.2
我试图为我的Android应用程序设置一些选项卡,但我卡住了.
我找不到标签之间的通信方式..
我有两个标签.
搜索选项卡只显示TextEdit和"搜索"按钮.点击搜索按钮应该让我的应用程序更改为结果选项卡并显示结果.
我已将选项卡添加为使用新意图的活动
TabHost host=getTabHost();
host.addTab(host.newTabSpec("one")
.setIndicator("Search")
.setContent(new Intent(this, SearchTabActivity.class)));
host.addTab(host.newTabSpec("Result")
.setIndicator("Android")
.setContent(new Intent(this, ResultTabActivity.class)));
Run Code Online (Sandbox Code Playgroud)
现在我无法找到SearchTabActivity显示ResultTabActivity并改变其视图的方法......
我期待着任何提示.
文本出现了,@color/blue代码中的其他地方没问题,还有什么阻止阴影出现?我已经尝试的1,10和100个值的shadowDx&shadowDy以及shadowRadius.阴影不会出现在编辑器中(显然预期TextView阴影不会在预览中显示 - 虽然在真实设备上工作)或在我的手机上,这是我的测试设备.
<TextView
android:id="@+id/shadow_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="i should be shadowed ..."
android:textColor="@android:color/white"
android:shadowColor="@color/blue"
android:shadowRadius="2"
android:shadowDx="1"
android:shadowDy="1"
android:textSize="@dimen/text" />
Run Code Online (Sandbox Code Playgroud)