小编dak*_*ntu的帖子

Android LinearLayout渐变背景

我无法将渐变背景应用于LinearLayout.

这应该比我读过的内容相对简单,但它似乎没有用.作为参考,我正在开发2.1-update1.

header_bg.xml:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <gradient
        android:angle="90"
        android:startColor="#FFFF0000"
        android:endColor="#FF00FF00"
        android:type="linear"/>
</shape>
Run Code Online (Sandbox Code Playgroud)

main_header.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="50dip"
    android:orientation="horizontal"
    android:background="@drawable/header_bg">
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

如果我将@ drawable/header_bg更改为颜色 - 例如#FF0000,它可以正常工作.我错过了一些明显的东西吗?

android gradient android-layout android-linearlayout

235
推荐指数
6
解决办法
24万
查看次数

如何在android中只设置edittext的数值?

我有一个edittext我只想插入整数值.谁能告诉我我必须使用哪个属性?

android android-edittext

200
推荐指数
5
解决办法
23万
查看次数

更改ListView的文本颜色

我正在尝试更改文本颜色,ListView但我无法找到如何做到这一点.. <

    listViewObject= (ListView) findViewById(R.id.chathlist);        
    ArrayList<String> chatHistory = new ArrayList<String>();
    chatHistory.add("Msg 1");
    chatHistory.add("Msg 2");
    chatHistory.add("Msg 3");
    chatHistory.add("Msg 4");
    chatHistory.add("Msg 5");
    chatHistory.add("Msg 6");
    chatHistory.add("Msg 7");
    ArrayAdapter aa=new ArrayAdapter<String>(getApplicationContext(),
    android.R.layout.simple_list_item_1, chatHistory);
    listViewObject.setAdapter(aa);
    listViewObject.invalidate();
Run Code Online (Sandbox Code Playgroud)

我尝试了很多方法,但我无法改变颜色.这可能是一件简单的事情,但我正在与此作斗争.

我的XML文件是

  <RelativeLayout android:id="@+id/chat_history_container"
            android:layout_width="fill_parent" android:layout_height="wrap_content">
            <ListView android:paddingTop="15dip" android:paddingBottom="15dip"
                android:layout_width="fill_parent" android:paddingLeft="15dip"
                android:layout_height="wrap_content" android:id="@+id/chathlist"
                android:layout_gravity="center_horizontal"
                android:layout_centerInParent="true" android:paddingRight="15dip"
                 android:textColor="#FF0000"  android:listSelector="@drawable/gradient_box" >
            </ListView>
  </RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

android listview colors android-widget

13
推荐指数
2
解决办法
8万
查看次数

如何将长行包装到vb.net中的标签控件中

我在标签中有50-60个单词的内容,它超出了我放置它的组合框,所以我需要将它包装起来,以便它可以容纳在groupbox中.

vb.net label

4
推荐指数
1
解决办法
2万
查看次数

如何解决PHP中的未定义索引

对于某些人来说,这可能是一个初学者问题,但我无法解决这个问题:看,我拥有的是一个简单的文本框和提交按钮。文本框需要输入数字(应该是用户的工资)。每当我在任何浏览器中加载 php 文件时,都会出现此错误(见下图)。第 35 行的代码是什么?

$a = $_POST['salary'];
Run Code Online (Sandbox Code Playgroud)

我不知道这有什么问题...

在此处输入图片说明

<form method="POST">

Salary: <input id="salarytext" type="text" name="salary" onkeypress="return isNumberKey(event)"><br>
<input type="submit" />
</form> 


<?php

$a = $_POST['salary'];

?>            

<?php
switch($a) {                        

    case ($a==""): echo "Input first your Compensation for the period!";
    break;

    case ($a < 1000 ): echo "Your Compensation is too low. You are not required to contribute for the period.";
    break;

    case ($a >=1000 && $a <=1249.99): echo "Your ER is 80.7 and Your EE is 33.30";
    break;

    case …
Run Code Online (Sandbox Code Playgroud)

php

-1
推荐指数
1
解决办法
334
查看次数