作为孩子,我有三个线性布局的相对布局.最后一个具有固定的高度,并将android:layout_alignParentBottom设置为"true".当中间的一个正确定位在第一个下方时,它会一直到屏幕的底部,因此它的下部与第三个重叠.
怎么了?
谢谢
<?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" >
<LinearLayout
android:id="@+id/category"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_alignParentTop="true"
android:orientation="horizontal" >
<ImageView
android:id="@+id/back_btn"
android:layout_width="29dp"
android:layout_height="34dp"
android:layout_gravity="center_vertical"
android:src="@drawable/red_arrow_left" />
<TextView
android:id="@+id/cat_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/category"
android:layout_marginTop="10dp"
android:orientation="horizontal" >
<ListView
android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/white"
android:cacheColorHint="@android:color/white" />
<TextView
android:id="@+id/android:empty"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/white"
android:cacheColorHint="@android:color/white"
android:padding="10dp"
android:text="@string/no_item" />
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/nav_bar"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
//stuff
</LinearLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud) 我正在使用WebView加载一些包含latin-1字符的数据
String uri = Uri.encode(html);
webview.loadData(uri, "text/html", "ISO-8859-1");
Run Code Online (Sandbox Code Playgroud)
显示时,latin1字符将被奇怪的字符替换.
如果我直接在TextView中加载html(只是为了测试),就会正确显示拉丁字符.
有人可以帮忙吗?
谢谢
HTML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- some html -->
</html>
Run Code Online (Sandbox Code Playgroud) 在EditText中书写时,如何在我的软键盘(Samsung Galaxy 10.1,Android 3.1)中使用"完成"按钮?
运用
<EditText
android:id="@+id/comment"
android:layout_width="772dp"
android:layout_height="200dp"/>
Run Code Online (Sandbox Code Playgroud)
我明白了
如果可能的话,我也想删除这个"附件"按钮.
有人可以帮忙吗?
编辑
我设法使用"完成"按钮
android:inputType="textImeMultiLine",
Run Code Online (Sandbox Code Playgroud)
但"返回"按钮消失了......
我怎么能两个都有?(我在这里问了这个新问题).
我正在尝试使用Makefile来编译一些测试C代码.该main.c
文件包含两个标题:
#include "circle_buffer.h"
#include "window.h"
Run Code Online (Sandbox Code Playgroud)
当我执行以下Makefile时
# compiler
CC=gcc
# compiler flags:
# -g adds debugging information to the executable file
# -Wall turns on most, but not all, compiler warnings
CFLAGS=
# include path
INCLUDES =
# library path and names
LIBS=-L/usr/lib/x86_64-linux-gnu -lsndfile
MAIN = test
$(MAIN): main.o circle_buffer.o window.o
$(CC) main.o circle_buffer.o window.o -o $(MAIN) $(LIBS)
main.o: main.c circle_buffer.h window.h
$(CC) -c main.c $(INCLUDES)
circle_buffer.o: circle_buffer.c circle_buffer.h
$(CC) -c circle_buffer.c $(INCLUDES)
window.o: window.h
$(CC) -c window.c …
Run Code Online (Sandbox Code Playgroud) 如何设置自定义ListView分隔符的宽度,以使其小于行宽?
鉴于以下型号
class AnotherModel(models.Model):
n = models.IntegerField()
class MyModel(models.Model):
somefield = models.ForeignKey(AnotherModel)
Run Code Online (Sandbox Code Playgroud)
和管理员
class MyModelAdmin(admin.ModelAdmin):
list_filter = ('somefield',)
Run Code Online (Sandbox Code Playgroud)
如何过滤实例AnotherModel
以仅n
在管理过滤器中显示具有给定值的实例?
我需要这样的东西:
过滤
通过某个地方
所有
[给定n的AnotherModel实例列表]
我从我找到的唯一一个例子中创建了一个自定义的SimpleCursorAdapter .
调用我的ListActivity时,将为每个数据库条目调用newView和bindView,并为每个条目再次调用.我有几个问题:
- 这是正确的例子(如果没有,我在哪里可以找到一个)?
-if bindView调用总是在newView调用之前,为什么在两个函数中都这样做?
为什么序列newView-bindView为每个项目调用两次?
为什么有些CursorAdapter示例使用getView而不是newView和bindView?
基本上,应该如何使用SimpleCursorAdapter,以及我的代码有什么问题?
谢谢
ListActivity
public class ContactSelection extends ListActivity {
private WhipemDBAdapter mDbHelper;
private FriendAdapter friendAdapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mDbHelper = new WhipemDBAdapter(this);
mDbHelper.open();
setContentView(R.layout.contact_list);
Cursor c = mDbHelper.fetchAllFriends();
startManagingCursor(c);
String[] from = new String[] {};
int[] to = new int[] {};
this.friendAdapter = new FriendAdapter(this, R.layout.contact_row, c, from, to);
setListAdapter(this.friendAdapter);
getListView().setItemsCanFocus(false);
getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
}
@Override
protected void onResume() {
super.onResume();
mDbHelper.open();
}
@Override
protected …
Run Code Online (Sandbox Code Playgroud) 我从http://code.google.com/p/google-gson/下载了Gson库.存档包含以下jar文件:
google-gson-1.3/gson-1.3-javadoc.jar
google-gson-1.3/gson-1.3.jar
google-gson-1.3/gson-1.3-sources.jar
如何设置Eclipse以便能够在我的项目中使用该包?我在哪里放文件?
我使用'display:none'在div中创建一个地图.使用谷歌地图v2,我可以将'size'参数设置为显示的div大小,但这个'size'选项在API的v3中消失了.
我怎样才能做到这一点?
我正在将自定义SimpleCursorAdapter设置为ListView.出于某种原因,对于DB中的每个项目,都会调用两次FriendAdapter的getView().经过一些调查(我的contact_list.xml中没有wrap_content),我仍然无法弄清楚原因.
可能是什么原因?有人可以帮忙吗?
谢谢
ContactSelection.java
public class ContactSelection extends ListActivity {
private WhipemDBAdapter mDbHelper;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mDbHelper = new WhipemDBAdapter(this);
mDbHelper.open();
setContentView(R.layout.contact_list);
Cursor c = mDbHelper.fetchAllFriends();
startManagingCursor(c);
String[] from = new String[] {};
int[] to = new int[] {};
setListAdapter(new FriendAdapter(this, R.layout.contact_row, c, from, to));
getListView().setItemsCanFocus(false);
getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
}
@Override
protected void onResume() {
super.onResume();
mDbHelper.open();
}
@Override
protected void onPause() {
super.onPause();
mDbHelper.close();
}
}
Run Code Online (Sandbox Code Playgroud)
FriendAdapter.java
public class FriendAdapter extends SimpleCursorAdapter implements OnClickListener {
private Context …
Run Code Online (Sandbox Code Playgroud)