我在TextInputLayout中使用show password图标时遇到了一些问题android:inputType="textPassword".现在它显示这样
你可以看到他们之间的差距.
用于实现TextInputLayout的xml sode如下:
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/TextLabelSNA"
app:layout_constraintTop_toBottomOf="@+id/mailSave"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
android:layout_marginStart="16dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginRight="16dp"
android:id="@+id/tilOp"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintVertical_bias="0.0">
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:inputType="textPassword"
android:hint="Old Password"
android:ems="10"
android:textColor="#0A0B12"
android:id="@+id/oldPassword"/>
</android.support.design.widget.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)
使用的风格是:
<style name="TextLabelSNA" parent="Widget.Design.TextInputLayout">
<!-- Hint color and label color in FALSE state -->
<item name="android:textColorHint">@color/hintBlack</item>
<item name="android:textSize">16sp</item>
<!-- Label color in TRUE state and bar color FALSE and TRUE State -->
<item name="colorAccent">@color/hintBlack</item>
<item name="colorControlNormal">@color/hintBlack</item>
<item name="colorControlActivated">@color/hintBlack</item>
</style>
Run Code Online (Sandbox Code Playgroud)
请帮忙..!!!
似乎android的Spinner类(一般可能是ListView,虽然我不确定)onItemSelected()在你调用之后调用你的OnItemSelectedListener的方法setAdapter(),即使用户还没有明确选择任何东西.
我可以看到这在许多情况下如何有用,但有时我只想onItemSelected()在实际特别选择项目时调用它.
有没有办法控制此行为并onItemSelected()在设置适配器后调用Spinner ?
我最近更新了我的支持库,com.android.support:appcompat-v7:25.1.0之后如果我将文本添加到EditTextvia xml文件中,则TextInputLayout提示不会浮动.
我也看过这个问题,但它对我不起作用.
这是我的xml代码:
<android.support.design.widget.TextInputLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginRight="16dp"
app:layout_constraintVertical_bias="0.0"
android:id="@+id/til1"
android:layout_marginStart="16dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="16dp"
app:layout_constraintHorizontal_bias="0.33">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="From"
android:inputType="time"
android:text="09:00 AM"
android:id="@+id/from_mon"
android:textSize="14sp" />
</android.support.design.widget.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的gradle依赖项:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile 'com.android.support:recyclerview-v7:25.1.0'
compile 'com.android.support:cardview-v7:25.1.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.github.bhargavms:DotLoader:1.0.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.labo.kaji:fragmentanimations:0.1.1'
compile …Run Code Online (Sandbox Code Playgroud) 我正在实现一个功能,当提示浮动时将textInputlayout提示文本的大小写更改为大写,反之亦然.
为此,我正在使用OnFocusChangeListener它的孩子textInputEditText.为了便于实现,我正在实施View.OnFocusChangeListener我的活动,如:
public class LoginActivity extends BaseActivity implements View.OnFocusChangeListener
Run Code Online (Sandbox Code Playgroud)
并覆盖活动中的方法,如:
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(findViewById(v.getId()) instanceof TextInputEditText){
TextInputLayout textInputLayout = (TextInputLayout) findViewById(v.getId()).getParent();
if(hasFocus){
textInputLayout.setHint(textInputLayout.getHint().toString().toUpperCase());
}else{
textInputLayout.setHint(Utility.modifiedLowerCase(textInputLayout.getHint().toString()));
}
}
}
Run Code Online (Sandbox Code Playgroud)
在上面的方法中,我试图textInputLayout使用该行获取父视图
TextInputLayout textInputLayout = (TextInputLayout) findViewById(v.getId()).getParent();
Run Code Online (Sandbox Code Playgroud)
上面的代码行引发致命错误
java.lang.ClassCastException:android.widget.FrameLayout无法强制转换为android.support.design.widget.TextInputLayout
它非常明显,因为它返回了Framelayout无法投入的内容textInputLayout
如果我使用
TextInputLayout textInputLayout = (TextInputLayout) findViewById(v.getId()).getRootView();
Run Code Online (Sandbox Code Playgroud)
它再次抛出一个致命的错误,因为无法投入的getRootView()回报DecorViewtextInputLayout
我的问题是如何textInputLayout从孩子那里得到父母textInputEditText?
请指导.
android android-design-library android-textinputlayout android-textinputedittext
我正在尝试创建一个具有自定义名称的 WiFi Direct 组。但在探索了所有选项之后,我发现我们无法更改名称,并且 Android 操作系统自行决定WiFi Direct 组的名称
我什至尝试使用Reflection来实现相同的目的,但它在Android Nougat 及更高版本上不起作用。
我使用以下代码创建 WiFi Direct 组:
WifiP2pManager manager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE);
WifiP2pManager.Channel channel = manager.initialize(this, getMainLooper(), null);
manager.createGroup(channel, new WifiP2pManager.ActionListener() {
@Override
public void onSuccess() {
Toast.makeText(getApplicationContext(), "Group Created", Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(int i) {
Toast.makeText(getApplicationContext(), "Group Creation Failed", Toast.LENGTH_SHORT).show();
}
});
Run Code Online (Sandbox Code Playgroud)
但是当我尝试 PDANet+ 应用程序时,他们能够创建一个带有后缀 PDANet 的 WiFi Direct 组名称。
例如:
我的应用程序生成以下组名称:DIRECT-mq-ONEPLUS
而 PDANet 生成:DIRECT-Dj-ONEPLUS A6000-PdaNet
所以我想知道他们如何将后缀添加到 WiFi Direct 组名称中。如果有人能在这方面帮助我,那将会有很大帮助。!
谢谢。!
我曾多次尝试在ARM Chromebook (C100P)上安装和使用Android Studio,但安装总是失败并显示错误。我读到这是因为 Android Studio 依赖于与 ARM 处理器架构不兼容的本机二进制文件;即使在尝试了各种 hack 或只是尝试单独使用这些库之后,我仍然无法在我的 ARM Chromebook 上设置 Android 开发环境。failed to run mksdcard tool
我正在尝试使用以下代码设置我的RatingBar样式:
<style name="RatingBarfeed" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorControlNormal">@color/white</item>
<item name="colorControlActivated">@color/duskYellow</item>
</style>
Run Code Online (Sandbox Code Playgroud)
在layout.xml中,我使用以下代码:
<android.support.v7.widget.AppCompatRatingBar
android:theme="@style/RatingBarfeed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/ratingBarStyleSmall"
android:id="@+id/ratingBar"
android:paddingBottom="0.45dp"
app:layout_constraintTop_toTopOf="@+id/rating"
app:layout_constraintLeft_toRightOf="@+id/rating"
app:layout_constraintBottom_toBottomOf="@+id/rating"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintHorizontal_bias="0.0"
android:background="@color/orange"
android:rating="3.5"
android:stepSize="0.5"/>
Run Code Online (Sandbox Code Playgroud)
请帮忙...!!!!
I'm creating an app that uses Google's Geolocation API, as documented here.
As part of the POST request I need to send to their API, I need to include The mobile radio type, radioType. The question of how to receive that has already been asked and answered here.
My question is as follows:
telephoneManager.getNetworkType()我显然应该使用的函数返回 18 个值之一,在此处记录为常量。
这是否意味着radioTypeGoogle 的地理定位 API 所描述的真的可以是 18 个不同的值?因此,如果事实证明我的无线电类型不是他们支持的四种类型(GSM、LTE、CDMA 或 WCDMA)之一,那么我只是运气不好,将不得不因不包括radioType在我的请求中而损失准确性?
我有一种感觉,我正在混淆这些术语radio type,network …
当我在“约束布局”中将android:layout_height="match_parent"或android:layout_width="match_parent"用作子项的高度/宽度并构建Gradle文件时,它将自动更改为android:layout_height="0dp"或android:layout_widtht="0dp"。
从技术上讲,0dp和match_parent之间存在巨大差异。
在大多数情况下,它不会影响我的布局,但有时这东西会完全破坏我的约束布局。
我不知道为什么会这样。
请指导我。
android android-layout android-studio android-constraintlayout
android ×10
java ×2
android-wifi ×1
arm ×1
chromebook ×1
google-api ×1
radio ×1
ratingbar ×1
ssid ×1
textview ×1
wifi-direct ×1
wifip2p ×1