时间类不再可以使用.我想问你,如何在凌晨3-4点检测到?我需要在我的应用程序中设置示例夜间模式.
你能举个例子怎么做吗?
我正在尝试将Ripple
效果添加到RecyclerView
项目中.我在网上看了一下,但找不到我需要的东西.我已经尝试了android:background
属性并将RecyclerView
其设置为"?android:selectableItemBackground"
但它没有工作:
我的父布局是这样的
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">
<android.support.v7.widget.RecyclerView
android:id="@+id/dailyTaskList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
android:scrollbars="vertical" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
和适配器模板如下所示
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp">
<TextView
android:id="@+id/txtTitle"
style="@style/kaho_panel_sub_heading_textview_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/txtDate"
style="@style/kaho_content_small_textview_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
请给我解决方案
android android-layout android-fragments recycler-adapter android-recyclerview
嗨大家我得到一个无法在我的OnCreateView
方法中解析构造函数ArrayAdapter,我listAdapter
试图在我的选项卡中列出文本数据,这是我的主要活动.任何帮助将不胜感激我仍然是一个noobie in Java
.
public class MainActivity extends ActionBarActivity {
private Toolbar toolbar;
private ViewPager mPager;
private SlidingTabLayout mTabs;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
toolbar = (Toolbar) findViewById(R.id.app_bar);
setSupportActionBar(toolbar);
mPager= (ViewPager) findViewById(R.id.viewPager);
mTabs=(SlidingTabLayout) findViewById(R.id.tabs);
mPager.setAdapter(new MyPagerAdapter(getSupportFragmentManager()));
mTabs.setDistributeEvenly(true);
mTabs.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
mTabs.setSelectedIndicatorColors(getResources().getColor(R.color.colorAccent));
mTabs.setViewPager(mPager);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public …
Run Code Online (Sandbox Code Playgroud) 我有一个ConstraintLayout
水平包含3个按钮.我希望3个按钮具有固定的宽度,并在布局的宽度上均匀分布.
如果用户只在EditText中输入空格但我不知道如何,我想显示错误?
这是我的简单工作
if (tName.getText().toString().matches(" ")) {
Toast.makeText(MainActivity.this, "Must Add Your Name Here", Toast.LENGTH_SHORT).show();
}
Run Code Online (Sandbox Code Playgroud) 所以我现在已经坚持了一个星期了...
我已经按照本教程:https: //code.tutsplus.com/tutorials/android-sdk-augmented-reality-camera-sensor-setup--mobile-7873
我在Canvas上动态绘制图像,然后通过旋转矩阵旋转,我从传感器获取.
我正在尝试做的是添加侦听器到我正在绘制和在画布上旋转的ImageView,但我无法想办法.
if (lastAccelerometer != null && lastCompass != null) {
boolean gotRotation = SensorManager.getRotationMatrix(rotation,
identity, lastAccelerometer, lastCompass);
if (gotRotation) {
float cameraRotation[] = new float[9];
// remap such that the camera is pointing straight down the Y
// axis
SensorManager.remapCoordinateSystem(rotation,
SensorManager.AXIS_X, SensorManager.AXIS_Z,
cameraRotation);
// orientation vector
float orientation[] = new float[3];
SensorManager.getOrientation(cameraRotation, orientation);
// draw horizon line (a nice sanity check piece) and the target (if it's on the screen)
canvas.save();
// use roll …
Run Code Online (Sandbox Code Playgroud) docClient.update({
TableName: 'patient',
Key: {
"patientId": "TIGERPAT0001"
},
UpdateExpression: "set title = :x, name = :y",
ExpressionAttributeNames: {
"#name": "name"
},
ExpressionAttributeValues: {
":x": 'title value abc',
":y": 'name value xyz'
}
}, function (err, data) {
if (err) {
json.status = '0';
json.result = { 'error': 'Unable to Edit Patient : ' + JSON.stringify(err) };
res.send(json);
} else {
json.status = '1';
json.result = { 'sucess': 'Patient Edited Successfully :' };
res.send(json);
}
});
Run Code Online (Sandbox Code Playgroud)
当使用上面的代码时,我得到了res:
无法编辑患者错误: {"message":"The number of …
我正在将一个类从 Java 移植到 Kotlin。这个类声明了数百个对象。每个对象都有一个名称属性,该属性与对象的声明变量名称相同。Java 反射允许通过反射使用声明的名称来设置对象成员name
。只需在数百个构造函数中保存一个参数。
我尝试在 Kotlin 中做同样的事情,但不知道如何进行属性设置。下面是一些简化的测试代码:
import kotlin.reflect.full.companionObject
import kotlin.reflect.full.declaredMemberProperties
class MyTestObject() {
var name: String = "NotInitialized"
companion object {
val Anton = MyTestObject()
val Berta = MyTestObject()
val Caesar = MyTestObject()
}
}
fun main(args : Array<String>) {
println(MyTestObject.Anton.name) // name not yet initialized
// Initialize 'name' with the variable name of the object:
for (member in MyTestObject::class.companionObject!!.declaredMemberProperties) {
if (member.returnType.toString() == "myPackage.MyTestObject") {
println("$member: ${member.name}")
// Set 'name' property to 'member.name':
// ??? …
Run Code Online (Sandbox Code Playgroud) 我的问题是如何Activity
在清单文件中正确指定处理不同的 MIME 类型。我正在尝试创建一个Activity
可以处理不同档案的文件,因此我将其添加到清单中,如下所示:
<activity
android:name=".activity.ArchiveActivity"
android:label="@string/title_activity_archive" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/zip" />
<data android:mimeType="application/gzip" />
<data android:mimeType="application/x-tar" />
<data android:mimeType="application/java-archive" />
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
不幸的是,这仅适用于 .zip 文件。例如,当我尝试从另一个应用程序打开 .jar 存档时,它告诉我无法找到合适的应用程序。提前致谢。
编辑事实证明,Android 无法理解最后三种 MIME 类型,因此我认为无法使用 Intents 在 Android 中打开 .jar 文件。
android intentfilter android-manifest android-intent android-activity
for ($key=0; $key < count($_POST['marks']); $key++) {
$from_marks = $_POST['from'][$key];
$get_marks = $_POST['marks'][$key];
//echo $from_marks." ";
if($get_marks > $from_marks){
// header("location: ../../pages/marks.php?over=err");
// break;
echo "Cant add more marks <br/>";
}
else{
echo $get_marks."<br/>";
$update_marks_query = $db->prepare(
"UPDATE sc_marks SET get_marks='"
.$get_marks
."' WHERE _sid='$sc_foreign_id' AND exam_type='$select_exam_type' ");
$update_marks_query -> execute();
}
}
Run Code Online (Sandbox Code Playgroud)
执行代码时出现问题,我在表的每一行中都获取了最后一个获取的值。
更新后的数据结果:
android ×7
android-tabs ×1
arraylist ×1
arrays ×1
canvas ×1
for-loop ×1
intentfilter ×1
java ×1
kotlin ×1
listener ×1
mysql ×1
node.js ×1
php ×1
reflection ×1
validation ×1