我的布局如下:
<?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="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
style="@style/behindMenuItemLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Twitter Feeds"
android:textStyle="bold" />
<ListView
android:id="@+id/list"
android:layout_width="350dp"
android:layout_height="50dp" />
<TextView
android:id="@+id/textView1"
style="@style/behindMenuItemLabel1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="1dp"
android:text="FaceBook Feeds" />
<ListView
android:id="@+id/list1"
android:layout_width="350dp"
android:layout_height="50dp" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我的要求是在和之间绘制一条水平线TextView
ListView
有人可以帮忙吗?
我要加载的URL中WebView
我使用了以下代码:
webView = (WebView) findViewById(R.id.webview1);
webView.setWebViewClient(new HostsWebClient());
webView.getSettings().setPluginState(PluginState.ON);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
webView.getSettings().setPluginsEnabled(true);
webView.getSettings().setSupportMultipleWindows(false);
webView.getSettings().setSupportZoom(false);
webView.setVerticalScrollBarEnabled(false);
webView.setHorizontalScrollBarEnabled(false);
webView.loadUrl(URL);
Run Code Online (Sandbox Code Playgroud)
但是当我执行它时,我无法加载网址.我的网页不可用.
有人可以帮忙吗?
我的活动代码如下:
public class Player extends Activity implements OnCompletionListener,
OnPreparedListener, OnErrorListener, OnBufferingUpdateListener, MusicFocusable {
private Boolean playState = false;
private String station = "http://38.101.19.5:9157";
public static final float DUCK_VOLUME = 0.1f;
private String artistName = null;
private String trackName = null;
private TextView artist;
private TextView track;
private TextView status;
private Button play;
enum AudioFocus {
NoFocusNoDuck, // we don't have audio focus, and can't duck
NoFocusCanDuck, // we don't have focus, but can play at a low volume
// ("ducking") …
Run Code Online (Sandbox Code Playgroud) 我有我的布局xml文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/titlename"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/HostName"
android:layout_weight="0"
/>
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
当我执行上面的,我的输出如下:
但我的要求是得到我的输出:
| text1: text2 |
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗?
我已经按照这个示例教程开发了一个示例应用程序http://www.androidhive.info/2013/07/android-expandable-list-view-tutorial/
如果我点击Core 我想在Core下的同一个屏幕中加载另一个列表,我怎么能这样做?使用我的下面的代码我可以在另一个屏幕中加载子列表,帮助?
我的ChildClickListener代码在这里:
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
// TODO Auto-generated method stub
Log.d("onChildClick", "onChildClick");
String position = (String) parentItems.get(groupPosition);
Log.d("position", position);
String child = listDataChild.get(position).get(childPosition);
Log.d("child", child);
if (child.equalsIgnoreCase("Core")) {
ArrayList<String> parentItems = new ArrayList<String>();
HashMap<String, List<String>> listDataChild = new HashMap<String, List<String>>();
ArrayList<String> childItems = new ArrayList<String>();
childItems.add("corejava");
childItems.add("corejava");
childItems.add("corejava");
childItems.add("corejava");
parentItems.add(position);
listDataChild.put(parentItems.get(0), childItems);
expandableList = (ExpandableListView) findViewById(R.id.lvExp);
CoreAdapter adapter = new CoreAdapter(parentItems,
listDataChild);
CustExpListview …
Run Code Online (Sandbox Code Playgroud) 我的xml布局中有My Table行,如下所示:
<TableRow
android:layout_marginTop="10dp"
>
<SeekBar
android:id="@+id/seekBar1"
android:layout_width="256dp"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/titlename"
android:layout_="@+id/playbtn"
android:layout_marginTop="4dp"
/>
<Button
android:id="@+id/playbtn"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:background="@drawable/play"
android:layout_marginBottom="3dp"/>
<Button
android:id="@+id/pausebtn"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_toTopOf="@+id/playbtn"
android:layout_alignParentBottom="true"
android:background="@drawable/pause"
android:layout_marginBottom="3dp"/>
</TableRow>
Run Code Online (Sandbox Code Playgroud)
我的输出如下,
我的要求是在布局中的同一位置显示播放暂停按钮?
有人可以帮忙吗?
我有一个textView,其大小为16个字符,如果超过16个字符,我想让它可以滚动到用户查看剩余的字符.任何人都可以帮助我吗?
我试过这个链接让TextView可以在Android上滚动
但没有结果?
我的TextView布局:
<TextView
android:id="@+id/tv1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:maxLength="16"
android:scrollbars = "vertical"
android:ellipsize="end"
android:text="fdgdddhhhdhd"
/>
Run Code Online (Sandbox Code Playgroud) 我有一个字符串变量包含文本行
line1(Contains String)
line2(Contains String)
line3(Contains String)
line4(Contains String)
Run Code Online (Sandbox Code Playgroud)
我的要求是得到最后一行文字?
有人可以帮忙吗?
我的日期字段(String)格式(MM / DD / YYYY)来自服务呼叫。我的要求是按日期对列表进行排序,并按最新日期显示记录。
我尝试了下面的代码。但是我无法显示最新日期的记录。
public class Test {
public static void main(String[] args) {
List<Opportunity> oppList = new ArrayList<Opportunity>();
Opportunity opp1 = new Opportunity();
opp1.setName("opp1");
opp1.setExpires("11/07/2016");
Opportunity opp2 = new Opportunity();
opp2.setName("opp2");
opp2.setExpires("11/08/2016");
oppList.add(opp1);
oppList.add(opp2);
List<Opportunity> opplist=sortOpportunitiesByDate(oppList);
/*Collections.sort(oppList);*/
for(int i=0; i<opplist.size(); i++){
System.out.println("Opportunity Data>>>"+opplist.get(i).getExpires());
}
}
private static List<Opportunity> sortOpportunitiesByDate(List<Opportunity> opportunities) {
Collections.sort(opportunities, new Comparator<Opportunity>() {
public int compare(Opportunity o1, Opportunity o2) {
DateFormat format = new SimpleDateFormat("MM/DD/YYYY",Locale.US);
Date date1 = null;
Date date2 = null;
try { …
Run Code Online (Sandbox Code Playgroud) 我想用lwuit创建一个超链接,我想在myForm屏幕上显示它?当我点击链接时,它应该导航到链接,我已经尝试了这个用于LCDUI,我得到了结果,但我不知道,如何使用LWUIT做到这一点?