我刚刚实现了方向更改功能 - 例如,当布局从纵向更改为横向时(反之亦然).如何检测方向更改事件何时完成.
在OrientationEventListener没有工作.如何获取有关布局方向更改事件的通知?
H TextViews里面有多个LinearLayout.现在我想在java中删除这个文本视图.视图是动态生成的.我怎样才能清空这里面的所有内容LinearLayout?
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content" android:orientation="vertical" android:id="@+id/myid">
<TextView .../>
<TextView .../>
<TextView .../>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 我正在学习一些学校项目的android,我无法弄清楚如何动态地将文本设置为TextView.
这是我的代码:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_enviar_mensaje);
err = (TextView)findViewById(R.id.texto);
err.setText("Escriba su mensaje y luego seleccione el canal.");
}
Run Code Online (Sandbox Code Playgroud)
这目前无效,我找不到让它工作的方法......
任何帮助都会得到充分的肯定......谢谢你的时间,José.
编辑:这是activity_enviar_mensaje.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
...
tools:context=".EnviarMensaje" >
...
<TextView
android:id="@+id/texto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/listaVista"
android:layout_alignParentBottom="true"
android:layout_alignRight="@+id/listaVista"
android:text="TextView" />
...
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
不工作我的意思是显示的文字随时都不会改变......
我收到以下运行时错误:
checkParameterIsNotNull, parameter oneClickTokens
at com.info.app.fragments.Fragment_Payment_Profile$fetchMerchantHashes$1.onPostExecute(Fragment_Payment_Profile.kt:0)
at com.info.app.fragments.Fragment_Payment_Profile$fetchMerchantHashes$1.onPostExecute(Fragment_Payment_Profile.kt:1543)
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
private fun fetchMerchantHashes(intent: Intent) {
// now make the api call.
val postParams = "merchant_key=$key&user_credentials=$var1"
val baseActivityIntent = intent
object : AsyncTask<Void, Void, HashMap<String, String>>() {
override fun doInBackground(vararg params: Void): HashMap<String, String>? {
...
}
override fun onPostExecute(oneClickTokens: HashMap<String, String>) {
super.onPostExecute(oneClickTokens)
...
}
}.execute()
}
Run Code Online (Sandbox Code Playgroud)
似乎函数调用似乎无效.但是,我不知道如何解决这个问题.Kotlin有什么具体的我错过了吗?
我想在我的应用程序中使用Material Design,但我的应用程序应该基于Jellybean而不是Lollipop.所以我的问题是:
我想用com.android.support:appcompat-v7:23.1.1.这是我的问题的可能解决方案吗?
我想了解更多关于compileSdkVersion和minSdkVersion:如果compileSdkVersion是20并且minSdkVersion是18,那么,如果我使用一些材料设计(在Lollipop,sdk20),如fab , cardview. 如果我在软糖设备中运行我的应用程序是否可以?(SdkVersion 18与之相同minSdkVersion)?
我是three.js的新手,并且有一些属于2D Text的问题:
我想要的是: 我想要一些标签,例如.x,y和z轴.标签应始终贴在相机上.也许以后他们只应该被展示,如果他们徘徊,但这是另一个话题.
我发现这个教程有什么问题(这是我想要实现的效果| http://stemkoski.github.io/Three.js/Sprite-Text-Labels.html),但这是旧版本的三个.js使用类似的方法var spriteAlignment = THREE.SpriteAlignment.topLeft;.我发现这个解决方法(THREE.SpriteAlignment显示为未定义)但我不清楚如何根据我的需要使用新方法.
我正在寻找的东西 也许你可以帮助我说出我正在寻找的东西,或者想出一个简短的方法.
是否可以在Chart.js中向现有图表添加水平线?
这里是示例char代码:
// the canvas
<canvas id="myChart" width="800" height="200"></canvas>
// the js
var ctx = document.getElementById("myChart").getContext("2d");
var myNewChart = new Chart(ctx).Bar(data);
Run Code Online (Sandbox Code Playgroud)
我想添加一个水平标记线(例如,y = 100,就像这个小提琴一样,用于高图)
我在适当的位置有Fragment“ A” ImageButton。单击此按钮后,将DialogFragment调用“ B”到前景,其中Fragment“ A”在背景中部分可见。DialogFragment“ B”为用户提供选择列表。单击特定选项后,DialogFragment“ B”将通过消失Dismiss(),Fragment“ A”再次变得完全可见。
在这个动作我需要更新ImageButton的Fragment“A”来表示用户的选择上进行DialogFragment“B”(基本上是一个新的形象的ImageButton)。
我认为在更新ImageButton片段“ A” 的正确位置期间正确OnResume吗?确实片段“A”进入OnPause,同时FragmentDialog正在显示“B”?因此,从DialogFragment“ B” 返回时,Fragment“ A”将触发它OnResume,这就是我应该对ImageButton呈现给用户的更新进行更改的地方?
希望我的解释清楚。任何关于我应该在哪里以及如何更新的详细帮助,ImageButton将不胜感激。
android android-lifecycle android-fragments android-dialogfragment
我已经搜索过,但没有找到任何有帮助的内容:
我有一个向量和一个 CylinderGeometry Mesh。我想实现的是,圆柱体面向矢量显示的点。作为输入,我得到了位置 (c) 和方向 (m)(如直线方程:y = mx + c):
function draw (m,c, _color) {
//... create the geometry and mesh
// set the position
line.position.x = c.x;
line.position.y = c.y;
line.position.z = c.z;
// i've tried something like this:
line.lookAt(c.add(m));
//.. and add to scene
}
Run Code Online (Sandbox Code Playgroud)
但看起来方向与我想要实现的目标完全相反。
我也尝试过翻译之类的东西:
geometry.applyMatrix( new THREE.Matrix4().makeTranslation(0, length/2, 0));
并尝试像这样手动旋转line.rotation.x = direction.angleTo(vec3(1,0,0))* 180 / Math.PI;。但他们都没有像我需要的那样工作。
嗨,
我想改变元素的value属性<input type="color">.如果我点击它,它的工作原理,但输入按钮的显示颜色不会改变.如果我从头开始手动更改颜色,它可以工作(但我必须在运行时更改它).
看看这个JSFiddle得到我的意思:http://jsfiddle.net/5u544/
谢谢和问候Mat
我正在使用PHPWord来使用 PHP 生成 Word 文档。实际上我需要添加以下格式的内容:
Title
Description
Image1
Image1 Description(HTML CONTENT)
Image2
Image2 Description(HTML CONTENT)
Run Code Online (Sandbox Code Playgroud)
所以实际上我正在添加一个部分并->addText()/->addImage()为此..但是在部分中我如何添加->addHtml()而不是->addText()
也许这个问题比我预期的要简单得多:我想显示notification在onCreatean的函数中创建的, Activity(出于调试原因)。
Android Studio 3.0.1, Api lvl 23(支持旧设备)并在具有 Api lvl 27 的 Nexus5 设备上运行。
显示通知的代码:
PendingIntent pi = PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), 0);
Notification notification = new NotificationCompat.Builder(this)
.setTicker("SomethingTicker")
.setSmallIcon(R.drawable.someImage)
.setContentTitle("SomeTitle")
.setContentText("SomeText")
.setContentIntent(pi)
.build();
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(001, notification);
Run Code Online (Sandbox Code Playgroud)
这表明NotificationCompat.Builder仅弃用上下文。我应该在较新版本中使用通知频道。
问题:要创建和注册 NotificationChannel,我必须使用 api lvl > 27。
我错过了什么?什么是最好的方法