当按返回按钮时,我的片段正在更改为主页,但底部图标没有更改。我在这里发布了所有代码。如果我从底部导航视图项目中选择了两个以上的导航按钮,则当我按“后退”按钮时,它将重定向到上一个选定的按钮项目。
但是现在发生的是,假设我在最后一个项目上说“通知”(如屏幕截图所示),现在当我按“后退”按钮时,它将直接带我到“主页”按钮,但是我想要的是应该先带我到“搜索”按钮项,然后到“主页”,而不是直接到“主页”。
我怎样才能做到这一点?
这是布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:design="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.segunfamisa.sample.bottomnav.MainActivity">
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#f1f1f1">
</FrameLayout>
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start"
design:menu="@menu/bottom_nav_items" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
这是活动:
public class MainActivity extends AppCompatActivity {
private static final String SELECTED_ITEM = "arg_selected_item";
private BottomNavigationView mBottomNav;
private int mSelectedItem;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mBottomNav = (BottomNavigationView) findViewById(R.id.navigation);
mBottomNav.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
selectFragment(item);
return true;
}
});
MenuItem selectedItem; …Run Code Online (Sandbox Code Playgroud) 我从中删除了一些gradle链接,build.gradle(app)但删除的库仍然显示在外部库文件夹中。
我有多个文档。我的问题是我无法获取修改的特定数据,我正在获取完整的文档。
db.collection("employees").whereEqualTo("OID", OID)
.addSnapshotListener(new EventListener<QuerySnapshot>() {
@Override
public void onEvent(@Nullable QuerySnapshot queryDocumentSnapshots, @Nullable FirebaseFirestoreException e) {
if (e != null) {
Log.w(TAG, "listen:error", e);
return;
}
for (DocumentChange dc : snapshots.getDocumentChanges()) {
switch (dc.getType()) {
case ADDED:
//Here i am getting full newly added documents
break;
case MODIFIED:
//here i am getting which is modified document,ok fine...,But i want to get only the filed which i modified instance of getting full documents..
break;
case REMOVED:
break;
}
}
}
}); …Run Code Online (Sandbox Code Playgroud) 我有一个充满自定义视图的应用程序.当我尝试以编程方式创建FAB时,它会抛出错误
引起:java.lang.IllegalArgumentException:您需要将Theme.AppCompat主题(或后代)与设计库一起使用.
这是我的代码.
private FloatingActionButton getFAB() {
FloatingActionButton fab = new FloatingActionButton(getContext());
fab.setBackgroundDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_add_white_24dp));
return fab;
}
Run Code Online (Sandbox Code Playgroud)
这是我的应用主题.
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
Run Code Online (Sandbox Code Playgroud)
请帮我.
我有一张桌子如下
date1 | date2 | datechoice
1-5-17 2-6-17 date2
Run Code Online (Sandbox Code Playgroud)
Datechoice可以是date1或date2.我想首先查看datechoice列,以确定在where语句中使用哪个列.
示例伪代码:
CASE WHEN datechoice ='date2'
THEN where date2 >= 2-2-17 AND where date2 <= 2-9-17
ELSE where date1 >= 2-2-17 AND where date1 <= 2-9-17
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
我想将Base64字符串转换为 png 格式的ImageView. 我现在正在使用:
byte[] decodedString = Base64.decode(imageString, Base64.DEFAULT);
Bitmap bmp = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
imageView.setImageBitmap(bmp);
Run Code Online (Sandbox Code Playgroud)
它工作完美,但我想要一个 png 图像。谢谢。
我想从坐标中获取地址。我在下面附上了我的代码..
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
let lastLocation = locations.last!
let latvalue = lastLocation.coordinate.latitude
let lngvalue = lastLocation.coordinate.longitude
self.db_latvalue = latvalue
self.db_lngvalue = lngvalue
let location = CLLocation(latitude: latvalue, longitude:lngvalue)
let address = CLGeocoder.init()
address.reverseGeocodeLocation(CLLocation.init(latitude: latvalue, longitude:lngvalue)) { (places, error) in
if error == nil{
if let place = places{
print("addressshowingssq \(place)")
self.db_address = "\(place)"
}
}
}
Run Code Online (Sandbox Code Playgroud)
输出:
[L-30 2nd A Main Road, L-30 2nd A Main Road, HSR Layout, Bengaluru, Karnataka 560102, India @ <+12.91597974,+77.62879254> …
注意: ImageView Click事件在Android中可用,我想知道它是否在iOS中可用
我是iOS新手,请考虑,我有相机图像,OnClick它我必须打开我的设备相机,但我正在获取Action的图像功能.附上截图
我的代码:
import UIKit
class AttendanceViewController: UIViewController {
@IBOutlet weak var loginimagebtn: UIImageView!
@IBOutlet weak var loginstatus: UITextView!
@IBOutlet weak var displayloginimg: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
}
func openCamer() {
if UIImagePickerController.isSourceTypeAvailable(
UIImagePickerControllerSourceType.camera) {
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerControllerSourceType.camera
imagePicker.allowsEditing = false
self.present(imagePicker,animated: true,completion : nil)
}
}
// For Toast message below code
func showToast(message : String) {
let toastLabel = UILabel(frame: CGRect(x: self.view.frame.size.width/2 - 75, y: self.view.frame.size.height-100, width: …Run Code Online (Sandbox Code Playgroud) 为什么我不能像这样使用@DELETE参数@Url
@DELETE
Call<ServerResponse> deleteAbsence(@Path("id") int absenceId , @Url String url);
Url passed ="././deleteAbsence/{id}"
Run Code Online (Sandbox Code Playgroud)
堆栈跟踪
java.lang.IllegalArgumentException: @Path can only be used with relative url on @DELETE (parameter #2)
for method WebApiInterface.deleteAbsence
at retrofit2.ServiceMethod$Builder.methodError(ServiceMethod.java:752)
at retrofit2.ServiceMethod$Builder.methodError(ServiceMethod.java:743)
at retrofit2.ServiceMethod$Builder.parameterError(ServiceMethod.java:761)
at retrofit2.ServiceMethod$Builder.parseParameterAnnotation(ServiceMethod.java:393)
at retrofit2.ServiceMethod$Builder.parseParameter(ServiceMethod.java:336)
at retrofit2.ServiceMethod$Builder.build(ServiceMethod.java:204)
at retrofit2.Retrofit.loadServiceMethod(Retrofit.java:170)
at retrofit2.Retrofit$1.invoke(Retrofit.java:147)
Run Code Online (Sandbox Code Playgroud)