我想做一个button圆角.有没有一种简单的方法可以在Android中实现这一目标?
我是Android开发的新手.我有一个XML文件,其中包含应用将读取的数据.我应该在哪里保留这个XML文件?它应该存储在"value"文件夹中吗?
我想知道如何增加表格行的高度,使其在较大的屏幕尺寸中看起来相称.目前,所有textview和edittexts(放置在表格行中)都显示在屏幕的左侧,而不是占据整个屏幕(仅在较大的屏幕尺寸中).这是我正在使用的xml:
<ScrollView android:id="@+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="@color/black_background">
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
>
<TableRow android:id="@+id/TableRow01"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:textColor="@color/white"
android:visibility="visible"
android:text="@string/Name"
android:layout_weight="0.2"
android:layout_marginLeft="20dp"
android:layout_marginTop="22dp"/>
<EditText android:id="@+id/myName"
android:layout_width="120dip"
android:layout_height="wrap_content"
android:textSize="20sp"
android:visibility="visible"
android:layout_weight="0.3"
android:inputType="number"
android:textColor="@color/black_background"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"/>
<TextView android:id="@+id/error1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
android:textColor="@color/red"
android:visibility="visible"
android:layout_weight="0.5"/>
</TableRow>
<TableRow android:id="@+id/TableRow02"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:id="@+id/address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:visibility="visible"
android:textColor="@color/white"
android:text="@string/address"
android:layout_weight="0.2"
android:layout_marginLeft="20dp" android:layout_marginTop="22dp"/>
<EditText android:id="@+id/address"
android:layout_width="120dip"
android:layout_height="wrap_content"
android:textSize="20sp"
android:visibility="visible"
android:inputType="number"
android:textColor="@color/black_background"
android:layout_weight="0.8"
android:layout_marginLeft="10dp" android:layout_marginTop="10dp"/>
</TableRow> …Run Code Online (Sandbox Code Playgroud) 我有一个edittext,我想在其中粘贴一些文本.我可以从某个网页复制文本,但是我无法将文本粘贴到我的edittext控件中.如何启用我的edittext来粘贴一些文本.这是我的edit.xml的main.xml;
enter code here
<EditText
android:id="@+id/enter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight= "2"
android:scrollbars="vertical"
android:textColor="@color/black"
/>
Run Code Online (Sandbox Code Playgroud)
谢谢
我想知道如何在android中的edittext控件中设置最大文本长度.我希望edittext能够处理大量文本.我怎样才能做到这一点.谢谢
EditText如果它是空的,我需要更改背景颜色.下面是我的代码,但似乎没有工作.
public void onClick(View v) {
// TODO Auto-generated method stub
Change();
}
public void Change() {
if(("").equals(name)) {
name.setBackgroundColor(Color.RED);
return;
}
}
Run Code Online (Sandbox Code Playgroud) 我想在XPathExpression中传递变量的值.我想将id值放在变量中.我怎样才能做到这一点?以下是代码;
XPathExpression expr = xpath.compile("//Number[@id=1]/Movies/text()");
Run Code Online (Sandbox Code Playgroud)
上面,我想把id的值放在一个变量中.我尝试了int num = 1但是没有用.谢谢.
我的活动中有一个搜索栏.在按钮事件中,当我转到另一个活动然后使用后退按钮时,搜索栏的值设置在用户离开它的位置.当用户回到搜索栏活动时,我想重置搜索栏.我怎样才能实现它?谢谢
public void onClick(View v) {
if (seek.getProgress > 0) {
// do something
}
}
Run Code Online (Sandbox Code Playgroud)