小编i_m*_*ine的帖子

如果单词对于textview来说太长,则强制下一个单词到新行

我有一个TextView,当以编程方式填充时,将无法正确划分单词.

电流输出:

这就是发生的事情:

| Hi I am an examp |
| le of a string t |
| hat is not break |
| ing correctly on |
| words            |
Run Code Online (Sandbox Code Playgroud)

预期产出:

我要这个:

| Hi I am an       |
| example of a     |
| string that is   |
| breaking         |
| correctly on     |
| words            |
Run Code Online (Sandbox Code Playgroud)

Java的:

String mQuestion = "Hi I am an example of a string that is breaking correctly on words";
mTextView.setText(mQuestion); …
Run Code Online (Sandbox Code Playgroud)

java xml android textview

10
推荐指数
2
解决办法
8652
查看次数

将li从一个ul移动到另一个jQuery

我正在尝试将列表项从一个无序列表移动到另一个列表.这在第一次工作正常,但一旦项目被移动,我无法将它们移回.我做了一个小提琴来说明我在说什么.

在这里查看 - > jsfiddle

HTML

<table>
    <tr>
        <td>Numbers</td>
        <td>Letters</td>
    </tr>
    <tr>
        <td>
            <ul class='list1'>
                <li>1</li>
                <li>2</li>
                <li>3</li>
                <li>4</li>
                <li>5</li>
            </ul>
        </td>
        <td>
            <ul class='list2'>
                <li>a</li>
                <li>b</li>
                <li>c</li>
                <li>d</li>
                <li>e</li>
            </ul>
        </td>
    </tr>
</table>
<input type='button' value='<<' id='move_left' />
<input type='button' value='>>' id='move_right' />
Run Code Online (Sandbox Code Playgroud)

jQuery的

$('body').on('click', 'li', function() {
   $(this).toggleClass('selected');
});

$('#move_left').click(function() {
    $('.list1').append('<li>', $('.list2 .selected').text(), '</li>');
    $('.list2 .selected').remove();
});

$('#move_right').click(function() {
    $('.list2').append('<li>', $('.list1 .selected').text(), '</li>');
    $('.list1 .selected').remove();
});
Run Code Online (Sandbox Code Playgroud)

CSS

ul {
    list-style-type:none;
    padding:0px;
    margin:0px;
}

.selected {
    background-color:#efefef;
} …
Run Code Online (Sandbox Code Playgroud)

javascript jquery

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

相对布局,将父对象的中心与视图的右对齐,且没有重叠

我试图将TextView对齐在相对布局的中心,但也要对齐ImageView的右边。我希望它看起来像这样。

[-(image)-----some text here------------]
Run Code Online (Sandbox Code Playgroud)

我可以使用以下代码执行此操作,但是如果文本太长,则会与图像重叠。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:paddingTop="@dimen/small_padding"
    android:paddingBottom="@dimen/small_padding"
    android:background="@color/White">

    <ImageView
        android:id="@+id/navMenu"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/home_icon"
        android:layout_marginEnd="@dimen/small_padding"
        android:contentDescription="@string/abc_search_hint"
        android:layout_alignParentStart="true" />

    <TextView
        android:id="@+id/actionBarTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/profile"
        android:textSize="24sp"
        android:textStyle="bold"
        android:textColor="@color/Black"
        android:maxLines="1"
        android:ellipsize="end"
        android:contentDescription="@string/title_activity_connect"
        android:layout_centerInParent="true" />

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

我已经尝试将TextView对齐到ImageView的右侧,但是如果这样做,它将停止以父对象为中心。任何帮助表示赞赏

android relativelayout

5
推荐指数
1
解决办法
1515
查看次数

Div隐藏JQuery后不显示

在使它onload在身体中看不见之后,我似乎无法使div出现.这应该很容易修复,我似乎无法弄明白.

PHP

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php include '/include/init.php'; ?>
<script type="text/javascript" src="/js/jqeury.js"> </script>
<script type="text/javascript" src="/js/accounts.js"> </script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="/css/style.css" />
<title>Accounts</title>
</head>

<body onload="hide_buttons()">
    <div class="accounts_headerDiv">
        <div class="ahd_left">
            <img src="/images/launcher2.png" class="accounts_logo"/>
            <p class="title_para"> Accounts </p>
        </div>
        <div class="ahd_right">
            <div class="searchDiv">
                <p class="searchPara"> Search </p>
                <input type="text" id="search_input" placeholder="search" class="search_input"/>
                <img src="/images/search_icon.png" class="search_icon"/>
            </div>
            <div class="userDiv">  
                <a href="#"><img src="/images/default-portrait-icon.jpg" align="right" class="user_picture"  /> </a>            
                <p …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery

3
推荐指数
1
解决办法
2660
查看次数

如何在表头下放置水平规则?

我试图<hr />在表头下放置一个水平规则<th>,但几乎没有成功.这可能没有黑客吗?

这是HTML我正在使用的和我尝试过的东西

<div id="epd" class="editProfileDiv">    
    <form>
        <table align="center">
            <th> Profile Information </th>
            <tr> 
                 <hr />                  
            </tr>
            <tr>
                <td>Name: </td>        
                <td><input id="name" name="name" value="<?php echo $_SESSION['name'];?>" placeholder=" Jon Doe" type="text" class=""></td>
            </tr> 
Run Code Online (Sandbox Code Playgroud)

该代码在浏览器中显示如下

----<hr/> is here----
 Profile Information
 Name:  <text input>
Run Code Online (Sandbox Code Playgroud)

然后我尝试了这个

<th> Profile Information </th>
<hr />                  
<tr><td> something here </td></tr>
Run Code Online (Sandbox Code Playgroud)

哪个具有完全相同的结果,它<hr/>位于表头之上

还有这个...

<tr> 
  <td> <hr /> </td> // If I only use one it only spans half the width of …
Run Code Online (Sandbox Code Playgroud)

html html5 html-table

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

标签 统计

android ×2

html ×2

javascript ×2

jquery ×2

html-table ×1

html5 ×1

java ×1

relativelayout ×1

textview ×1

xml ×1